Difference between revisions of "Drag drop dartboard question view"

From Catglobe Wiki
Jump to: navigation, search
m (Created page with '==Drag drop dartboard question view== The Drag drop dartboard question view transforms a scale grid question into a vertical scale where sub questions, which must be specified as…')
(No difference)

Revision as of 11:42, 10 May 2010

Drag drop dartboard question view

The Drag drop dartboard question view transforms a scale grid question into a vertical scale where sub questions, which must be specified as images, can be dragged up or down to the level of the scale.

Setting up the resources

The Drag drop dartboard needs two attachments in order to work, a Flash-file which creates the question view and a JavaScript-file which wraps the Flash-file to simplify the usage in question script.

The following step-by-step guide describes a best practice for placing question views, it will walk you through setting up the Drag drop dartboard on your Catglobe site.

The guide assumes that it is the first question view you are adding to the site, so some steps can be skipped if the basic structure has already been established.

Before you start, you must have the necessary navigation and resource access, talk with your site administrator about that, she might have to give you additional permissions to complete the steps below.

  1. Go to 'folders'
  2. Create a folder called 'Common resources' below 'SYSTEM' if it doesn't exist already, leave inheritance on
  3. Create a folder called 'Question views' below the folder 'Common resources' if it doesn't exist already, leave inheritance on, leave inheritance on
  4. Create a folder called 'Drag drop dartboard' below the folder 'Question views' if it doesn't exist already, leave inheritance on
  5. Open the attachment tab of the 'Drag drop dartboard' folder and upload the two files DragSlider.js and DragSlider.swf, make sure to keep the names including the file extension, it will make it easier to recognize the files in the next step
  6. Go to 'tools > Projects and folders > Attachments'
  7. Search by name for 'DragSlider' anywhere in name, given that you named the attachments according to the suggested naming in the step above
  8. Make sure to include the Link column in the attachment resource list, you'll need it for getting the GUID of the two attachments
  9. The link column for the files will look something like this:
    http://vnsurvey.catglobe.com/Attachments/GetAttachment.aspx?rid=20eb9e88-69cc-4b03-bbe0-b0dbda53d285 (DragSlider.js)
    http://vnsurvey.catglobe.com/Attachments/GetAttachment.aspx?rid=e8397d22-22cd-439b-932b-e36fe68b88c4 (DragSlider.swf)
  10. You should extract the GUIDs only, note them down now together with their filename, you will need it for setting up the question:
    DragSlider.js: 20eb9e88-69cc-4b03-bbe0-b0dbda53d285
    DragSlider.swf: e8397d22-22cd-439b-932b-e36fe68b88c4
  11. Create a group called 'Drag drop dartboard access' under the folder 'Drag drop dartboard'
  12. Give the group 'Drag drop dartboard access' observer access to the folder 'Drag drop dartboard'
  13. Add the user with username 'anonymous' to the group 'Drag drop dartboard access', this is necessary for test links and anonymous access to work
  14. All respondents participating in questionnaires using the DragSlider must be added to the group 'Drag drop dartboard access' else they will not be able to see the Drag drop dartboard when answering the questionnaire

Respondents can be added to the 'Drag drop dartboard access' group dynamically through a dummy question in the beginning of the questionnaire to avoid adding respondents unecessarily to the group.

We have the necessary resources setup, and the GUIDs we need to configure the question script in the next section.

Configuration of the question

The Drag drop dartboard must be configured for a scale grid, where each sub question must contain an img tag pointing to the picture which should be displayed.

Since there is only one scale the minimum and maximum values for the first sub question are used to define the extremeties of the scale, likewise the first sub question is also used to define the minimum and maximum text.

The other sub questions should still contain minimum and maximum values since the navigation engine validates the inputted values, and minimum and maximum text should also be added, as i makes it easier to process collected data afterwards.

Below is shown an example in QSL of a scale grid question configured with the Drag drop dartboard question view, it's ready to be imported to your questionnaire and modified to fit your needs.

When using this example you must remember to replace 'JavaScript GUID', and 'Flash GUID' with those GUIDs you found in the previous section, keep the quotes. You can insert the images from the questionnaire editor, they should be uploaded to the questionnaire template then inserted into the sub questions.

QUESTIONNAIRE
[
	HTML=true;
	NEXT_BUTTON_VISIBLE = true;
	BACK_BUTTON_VISIBLE = true;
	REQUIRED = true;
]

QUESTION DragSlider SCALEGRID
[
JAVA_SCRIPT = "
// Enter the GUID for the JavaScript attachment
var javaScriptGuid = 'JavaScript GUID';

// Enter the GUID for the Flash attachment
var flashGuid = 'Flash GUID';

// Modify the question after the DOM has finished loading to get jQuery access
quest.onInit = function()
{
   // Load the JavaScript attachment
   $.getScript(
      '../../Attachments/GetAttachment.aspx?rid=' + javaScriptGuid,
      function()
      {
         // Create an instance of the Drag drop dartboard
         var myDragSlider = new DragSlider(quest, flashGuid);
         
         // Do some configuration
         myDragSlider.config.scale.fontColor = 'FF0000';
         myDragSlider.config.scale.fontSize = '12';
      
         // Initalize the Drag drop dartboard
         myDragSlider.init();
      }
   );
};";
]
How do you feel about these brands?
SQ: [
REVERSE = false;
MAX_TEXT = "Positive trend";
MIN_TEXT = "Negative trend";
MIN_VALUE = 1;
MAX_VALUE = 10;
DISCRETE = false;
STEP = 1;
] <img height="62" src="path to image 1" style="border: 0" width="61">
SQ: [
REVERSE = false;
MAX_TEXT = "Positive trend";
MIN_TEXT = "Negative trend";
MIN_VALUE = 1;
MAX_VALUE = 10;
DISCRETE = false;
STEP = 1;
] <img height="62" src="path to image 2" style="border: 0" width="61">
SQ: [
REVERSE = false;
MAX_TEXT = "Positive trend";
MIN_TEXT = "Negative trend";
MIN_VALUE = 1;
MAX_VALUE = 10;
DISCRETE = false;
STEP = 1;
] <img height="62" src="path to image 3" style="border: 0" width="61">
SQ: [
REVERSE = false;
MAX_TEXT = "Positive trend";
MIN_TEXT = "Negative trend";
MIN_VALUE = 1;
MAX_VALUE = 10;
DISCRETE = false;
STEP = 1;
] <img height="62" src="path to image 4" style="border: 0" width="61">
SQ: [
REVERSE = false;
MAX_TEXT = "Positive trend";
MIN_TEXT = "Negative trend";
MIN_VALUE = 1;
MAX_VALUE = 10;
DISCRETE = false;
STEP = 1;
] <img height="62" src="path to image 5" style="border: 0" width="61">

The image path will look something like the following:

../../Images/GetImage.aspx?rid=8b8121cc-5ae5-4679-857b-12302efe70aa

If you already have a scale grid question which you want to apply the Drag drop dartboard question view to, then you just copy and paste the following JavaScript into the question script property for the question:

// Enter the GUID for the JavaScript attachment
var javaScriptGuid = 'c0d002a9-056f-4fdc-ba65-401bddea9e9d';

// Enter the GUID for the Flash attachment
var flashGuid = '216db971-5f3a-4179-9999-bd4831e160a4';

// Modify the question after the DOM has finished loading to get jQuery access
quest.onInit = function()
{
   // Load the JavaScript attachment
   $.getScript(
      '../../Attachments/GetAttachment.aspx?rid=' + javaScriptGuid,
      function()
      {
         // Create an instance of the drag slider
         var myDragDropDartboard = new DragDropDartboard(quest, flashGuid, 'D_ImagePositions', [{{D_ImagePositions}}]);
         
        // Do some configuration
		myDragDropDartboard.config.dartboard.fontColor = '000000';
		myDragDropDartboard.config.dartboard.fontSize = '15';
		myDragDropDartboard.config.dartboard.fontText = 'Arial';
		myDragDropDartboard.config.dartboard.oddColor = '865000';
		myDragDropDartboard.config.dartboard.evenColor = 'FFAA00';
		myDragDropDartboard.config.dartboard.borderColor = '000000'; 
      
         // Initalize the drag slider
         myDragDropDartboard.init();
      }
   );
};

Limitations

In the current implementation it's not possible to use permutations on the sub questions, doing so will lead to bad data, since the chosen values will be coded to sub questions randomly.