Skip to content

Commit

Permalink
Templates
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerburleigh committed Aug 30, 2019
1 parent 299ab68 commit 510a8f0
Show file tree
Hide file tree
Showing 9 changed files with 392 additions and 0 deletions.
28 changes: 28 additions & 0 deletions inst/templates/answerkey1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<AnswerKey xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/AnswerKey.xsd">
<Question>
<QuestionIdentifier>question1</QuestionIdentifier>
<AnswerOption>
<SelectionIdentifier>3</SelectionIdentifier>
<AnswerScore>10</AnswerScore>
</AnswerOption>
</Question>
<Question>
<QuestionIdentifier>question2</QuestionIdentifier>
<AnswerOption>
<SelectionIdentifier>1</SelectionIdentifier>
<AnswerScore>10</AnswerScore>
</AnswerOption>
</Question>
<Question>
<QuestionIdentifier>question3</QuestionIdentifier>
<AnswerOption>
<SelectionIdentifier>4</SelectionIdentifier>
<AnswerScore>10</AnswerScore>
</AnswerOption>
</Question>
<QualificationValueMapping>
<PercentageMapping>
<MaximumSummedScore>30</MaximumSummedScore>
</PercentageMapping>
</QualificationValueMapping>
</AnswerKey>
25 changes: 25 additions & 0 deletions inst/templates/categorization1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<title>Example Categorization Task</title>
<script type='text/javascript' src='https://s3.amazonaws.com/mturk-public/externalHIT_v1.js'></script>
</head>
<body>
<form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'>
<input type='hidden' value='' name='assignmentId' id='assignmentId'/>
<h1>What is this an image of?</h1>
<img src="${imageurl}" alt="${imageurl}" style="width=120px; display:block; margin-left:auto; margin-right:auto;" />
<p>What is this an image of?</p>
<p>
<input type="radio" name="QuestionId1" value="person" id="q1a" /><label for="q1a">Person</label><br />
<input type="radio" name="QuestionId1" value="animal" id="q1b" /><label for="q1b">Animal</label><br />
<input type="radio" name="QuestionId1" value="fruit" id="q1c" /><label for="q1c">Fruit</label><br />
<input type="radio" name="QuestionId1" value="vegetable" id="q1d" /><label for="q1d">Vegetable</label><br />
<input type="radio" name="QuestionId1" value="something else" id="q1e" /><label for="q1e">Something else</label>
</p>
<input type="hidden" name="imageurl" value="${imageurl}" />
<p><input type='submit' id='submitButton' value='Submit' /></p></form>
<script>turkSetAssignmentID();</script>
</body>
</html>
16 changes: 16 additions & 0 deletions inst/templates/htmlquestion1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<title>Example HTMLQuestion Form</title>
<script type='text/javascript' src='https://s3.amazonaws.com/mturk-public/externalHIT_v1.js'></script>
</head>
<body>
<form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'>
<input type='hidden' value='' name='assignmentId' id='assignmentId'/>
<h1>What's up?</h1>
<p><textarea name='comment' cols='80' rows='3'></textarea></p>
<p><input type='submit' id='submitButton' value='Submit' /></p></form>
<script>turkSetAssignmentID();</script>
</body>
</html>
18 changes: 18 additions & 0 deletions inst/templates/htmlquestion2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<title>Example HTMLQuestion Form</title>
<script type='text/javascript' src='https://s3.amazonaws.com/mturk-public/externalHIT_v1.js'></script>
</head>
<body>
<form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'>
<input type='hidden' value='' name='assignmentId' id='assignmentId'/>
<h1>${hittitle}</h1>
<p>${hitvariable}</p>
<p>What do you think?</p>
<p><textarea name='comment' cols='80' rows='3'></textarea></p>
<p><input type='submit' id='submitButton' value='Submit' /></p></form>
<script>turkSetAssignmentID();</script>
</body>
</html>
44 changes: 44 additions & 0 deletions inst/templates/htmlquestion3.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<title>Example HTMLQuestion Form</title>
<script type='text/javascript' src='https://s3.amazonaws.com/mturk-public/externalHIT_v1.js'></script>
</head>
<body>
<form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'>
<input type='hidden' value='' name='assignmentId' id='assignmentId'/>
<h1>What's up?</h1>
<p>
<input type='radio' name='QuestionId1' value='A' id='q1a' /><label for='q1a'>Nothing</label>
<br />
<input type='radio' name='QuestionId1' value='B' id='q1b' /><label for='q1b'>Something</label>
</p>
<h1>Really?</h1>
<p>
<input type='radio' name='QuestionId2' value='A' id='q2a' /><label for='q1a'>Yes</label>
<br />
<input type='radio' name='QuestionId2' value='B' id='q2b' /><label for='q1b'>No</label>
</p>
<h1>Is this a question?</h1>
<p>
<input type='radio' name='QuestionId3' value='A' id='q3a' /><label for='q1a'>Yes</label>
<br />
<input type='radio' name='QuestionId3' value='B' id='q3b' /><label for='q1b'>No</label>
</p>
<h1>Is this also a question?</h1>
<p>
<input type='radio' name='QuestionId4' value='A' id='q4a' /><label for='q1a'>Yes</label>
<br />
<input type='radio' name='QuestionId4' value='B' id='q4b' /><label for='q1b'>No</label>
</p>
<h1>Finally, is this also a question?</h1>
<p>
<input type='radio' name='QuestionId5' value='A' id='q5a' /><label for='q1a'>Yes</label>
<br />
<input type='radio' name='QuestionId5' value='B' id='q5b' /><label for='q1b'>No</label>
</p>
<p><input type='submit' id='submitButton' value='Submit' /></p></form>
<script>turkSetAssignmentID();</script>
</body>
</html>
104 changes: 104 additions & 0 deletions inst/templates/qualificationtest1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<QuestionForm xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionForm.xsd">
<Overview>
<Title>Please read the following passage and answer the questions below based upon what you read.</Title>
<Text>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras non enim id neque pharetra euismod. Nam ornare luctus ante. In non dui eu lacus volutpat aliquet et eget sapien. In facilisis tortor lorem. Sed ornare tortor ut metus ullamcorper vitae tristique sapien tincidunt. Nunc molestie lacinia dignissim. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In pulvinar lectus ut nunc consequat pulvinar pretium dui ullamcorper. Duis id leo ut augue placerat rhoncus et pretium velit. Vestibulum ultricies, felis id hendrerit aliquet, massa tellus commodo nisi, id laoreet nisi metus nec elit.
</Text>
</Overview>
<Question>
<QuestionIdentifier>question1</QuestionIdentifier>
<IsRequired>true</IsRequired>
<QuestionContent>
<FormattedContent><![CDATA[
<p>Some question here</p>
]]></FormattedContent>
</QuestionContent>
<AnswerSpecification>
<SelectionAnswer>
<StyleSuggestion>radiobutton</StyleSuggestion>
<Selections>
<Selection>
<SelectionIdentifier>1</SelectionIdentifier>
<Text>First Answer</Text>
</Selection>
<Selection>
<SelectionIdentifier>2</SelectionIdentifier>
<Text>Second Answer</Text>
</Selection>
<Selection>
<SelectionIdentifier>3</SelectionIdentifier>
<Text>Third Answer</Text>
</Selection>
<Selection>
<SelectionIdentifier>4</SelectionIdentifier>
<Text>Fourth Answer</Text>
</Selection>
</Selections>
</SelectionAnswer>
</AnswerSpecification>
</Question>
<Question>
<QuestionIdentifier>question2</QuestionIdentifier>
<IsRequired>true</IsRequired>
<QuestionContent>
<FormattedContent><![CDATA[
<p>Some question here</p>
]]></FormattedContent>
</QuestionContent>
<AnswerSpecification>
<SelectionAnswer>
<StyleSuggestion>radiobutton</StyleSuggestion>
<Selections>
<Selection>
<SelectionIdentifier>1</SelectionIdentifier>
<Text>First Answer</Text>
</Selection>
<Selection>
<SelectionIdentifier>2</SelectionIdentifier>
<Text>Second Answer</Text>
</Selection>
<Selection>
<SelectionIdentifier>3</SelectionIdentifier>
<Text>Third Answer</Text>
</Selection>
<Selection>
<SelectionIdentifier>4</SelectionIdentifier>
<Text>Fourth Answer</Text>
</Selection>
</Selections>
</SelectionAnswer>
</AnswerSpecification>
</Question>
<Question>
<QuestionIdentifier>question3</QuestionIdentifier>
<IsRequired>true</IsRequired>
<QuestionContent>
<FormattedContent><![CDATA[
<p>Some question here</p>
]]></FormattedContent>
</QuestionContent>
<AnswerSpecification>
<SelectionAnswer>
<StyleSuggestion>radiobutton</StyleSuggestion>
<Selections>
<Selection>
<SelectionIdentifier>1</SelectionIdentifier>
<Text>First Answer</Text>
</Selection>
<Selection>
<SelectionIdentifier>2</SelectionIdentifier>
<Text>Second Answer</Text>
</Selection>
<Selection>
<SelectionIdentifier>3</SelectionIdentifier>
<Text>Third Answer</Text>
</Selection>
<Selection>
<SelectionIdentifier>4</SelectionIdentifier>
<Text>Fourth Answer</Text>
</Selection>
</Selections>
</SelectionAnswer>
</AnswerSpecification>
</Question>
</QuestionForm>
30 changes: 30 additions & 0 deletions inst/templates/sentiment1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<title>Example Sentiment Rating Task</title>
<script type='text/javascript' src='https://s3.amazonaws.com/mturk-public/externalHIT_v1.js'></script>
<script>
function showVal(newVal){
document.getElementById("rangevalue").innerHTML=newVal;
}
</script>
</head>
<body>
<form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'>
<input type='hidden' value='' name='assignmentId' id='assignmentId'/>
<h1>Rate this tweet</h1>
<p>From negative (-10) to positive (+10), how would you rate the sentiment of the following tweet?</p>
<p>${tweettext}</p>
<p>
-10 <input type="range" name="sentiment" value="0" min="-10" max="10" step="1"
oninput="showVal(this.value)" onchange="showVal(this.value)" /> +10
</p>
<p>
Your rating: <span id="rangevalue"></span>
</p>
<input type="hidden" name="tweetid" value="${tweetid}" />
<p><input type='submit' id='submitButton' value='Submit' /></p></form>
<script>turkSetAssignmentID();</script>
</body>
</html>
61 changes: 61 additions & 0 deletions inst/templates/surveylink.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html>
<head>
<title>Survey Link Example</title>
</head>
<body>
<div style="font-family:sans-serif;margin-left:10%;margin-right:10%;">
<p style="font-weight:bold;margin-left:15%;margin-right:15%;font-size:2em;">Pipe MTurk parameters via URL</p>

<!-- THIS IS THE HTML FORM NEEDED TO BE ABLE TO SUBMIT THE HIT -->
<form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'>

<!-- THIS IS WHERE THE LINK WILL APPEAR -->
<span id='link'>Link will appear here once HIT is accepted. If it does not, make sure javascript is enabled in your browser.</span>

<p style='text-align:center;'>After completing the survey, enter the completion code from last page here:<br /><input type='text' id='complete' name='complete' /></p>
<p><input type='submit' id='submitButton' value='Submit' /></p>
</form>

<script type="text/javascript">
/* RETRIEVE URL */
var fullurl=new String();
/* THIS IS THE LINE TO CAPTURE THE ACTUAL URL: */
var fullurl=window.location.href;

/* FUNCTION TO EXTRACT A URL PARAMETER (FROM: https://s3.amazonaws.com/mturk-public/externalHIT_v1.js) */
function turkGetParam( name ) {
var regexS = "[\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var tmpURL = fullurl;
var results = regex.exec( tmpURL );
if( results == null ) {
return "";
} else {
return results[1];
}
}

/* ASSIGNS THE URL PARAMETERS TO JAVASCRIPT VARIABLES */
var assign = turkGetParam('assignmentId');
var hit = turkGetParam('hitId');
var worker = turkGetParam('workerId');

/* THIS PART BUILDS THE LINK FOR AN ACCEPTED ASSIGNMENT */
if(assign=="ASSIGNMENT_ID_NOT_AVAILABLE") {
/* THIS IS A MESSAGE ABOUT THE HIT BEING IN PREVIEW MODE (SO IT WON'T SHOW THE LINK) */
document.getElementById('link').innerHTML = "<p style='font-weight:bold;text-align:center;'>Link will become available once you accept the HIT.</p>";
} else {
/* CONSTRUCT THE SURVEY LINK WITH THE EMBEDDED VALUES: */
var surveylink = new String("http://www.example.com/"
+ "?assignmentId=" + assign
+ "&hitId=" + hit
+ "&workerId=" + worker
);
/* DISPLAY THE LINK */
document.getElementById('link').innerHTML = "<p><a href='" + surveylink + "' target='_blank'>Complete this survey</a></p>";
}
</script>
</div>
</body>
</html>
Loading

0 comments on commit 510a8f0

Please sign in to comment.