Difference between revisions of "Drag drop dartboard question view"

From Catglobe Wiki
Jump to: navigation, search
m (Setting up the resources)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
<accesscontrol>Main:MyGroup</accesscontrol>
 +
[[Category:Miscellaneous]]
 +
 
==Drag drop dartboard question view==
 
==Drag drop dartboard question view==
 
The Drag drop dartboard question view transforms a scale grid question into a dartboard where sub questions, which must be specified as images, can be dragged into to the dartboard with level specified from min and max value.
 
The Drag drop dartboard question view transforms a scale grid question into a dartboard where sub questions, which must be specified as images, can be dragged into to the dartboard with level specified from min and max value.
Line 28: Line 31:
 
8. Select the attachment from the list, press Ctrl-C, open a text editor such as Notepad, paste the value from the clipboard, get the GUID out of it (this feature will not work in other browsers except Internet Explorer)  
 
8. Select the attachment from the list, press Ctrl-C, open a text editor such as Notepad, paste the value from the clipboard, get the GUID out of it (this feature will not work in other browsers except Internet Explorer)  
  
Example: ''369734,<span style="color: #ff0000">65b8671f-6e47-4ec5-9a7b-205c71908fb0</span>&lt;img src=http://mycatinet.catglobe.com/Images/Attachment/notype.gif&gt;&lt;/img&gt; Common resources\Question Views\Drag Drop Pictures Fri May 14 12:44:04 UTC+0700 2010 Hjarnaa, Ulrik (ulrikhjarnaa) Fri May 14 12:44:04 UTC+0700 2010 Hjarnaa, Ulrik (ulrikhjarnaa) Fri May 14 12:44:04 UTC+0700 2010 Hjarnaa, Ulrik (ulrikhjarnaa) 9.104 KB 36685371 DragDropPictures''  
+
Example: ''369734,<span style="color: #ff0000">65b8671f-6e47-4ec5-9a7b-205c71908fb0</span>&lt;img src=http://mycatinet.catglobe.com/Images/Attachment/notype.gif&gt;&lt;/img&gt; Common resources\Question Views\DragDropDartboard Fri May 14 12:44:04 UTC+0700 2010 Hjarnaa, Ulrik (ulrikhjarnaa) Fri May 14 12:44:04 UTC+0700 2010 Hjarnaa, Ulrik (ulrikhjarnaa) Fri May 14 12:44:04 UTC+0700 2010 Hjarnaa, Ulrik (ulrikhjarnaa) 9.104 KB 36685371 DragDropDartboard''
  
 
9. You should extract the GUIDs only, note them down now together with their filename, you will need it for setting up the question:<br>DragDropDartboard.js: 65b8671f-6e47-4ec5-9a7b-205c71908fb0<br>DragDropDartboard.swf: 216db971-5f3a-4179-9999-bd4831e160a4  
 
9. You should extract the GUIDs only, note them down now together with their filename, you will need it for setting up the question:<br>DragDropDartboard.js: 65b8671f-6e47-4ec5-9a7b-205c71908fb0<br>DragDropDartboard.swf: 216db971-5f3a-4179-9999-bd4831e160a4  
Line 51: Line 54:
 
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.
 
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.
  
Beside that, we need one more dummy question to store the position of images inside dartboard.
+
Beside that, we need one more dummy question with Open type to store the position of images inside dartboard.
  
 
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.
 
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', 'Flash GUID' with those GUIDs you found in the previous section, keep the quotes. And change 'D_ImagePositions' to the label name of dummy question you created. You can insert the images from the questionnaire editor, they should be uploaded to the questionnaire template then inserted into the sub questions.
+
When using this example you must remember to replace 'JavaScript GUID', 'Flash GUID' with those GUIDs you found in the previous section, keep the quotes. And change 'D_ImagePositions' to the label name of dummy question you created. You can insert the images from the questionnaire editor, they should be uploaded to the questionnaire template then inserted into the sub questions. And you can edit some flash view configuration as you need (size of flash, pictures size, dartboard ring color,...).  
  
 
<source lang="javascript">
 
<source lang="javascript">
Line 76: Line 79:
 
// Enter the GUID for the Flash attachment
 
// Enter the GUID for the Flash attachment
 
var flashGuid = '216db971-5f3a-4179-9999-bd4831e160a4';
 
var flashGuid = '216db971-5f3a-4179-9999-bd4831e160a4';
 +
 +
// Enter the dimension for the Flash
 +
var flashWidth = 500;
 +
var flashHeight = 400;
 +
 +
// Insert the flash
 +
quest.text += '<p><object width="' + flashWidth + '" height="' + flashHeight +  '" id="dragDropDartboardFlash"
 +
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0">
 +
<param name="quality" value="high">
 +
<param name="movie" value="../../Attachments/GetAttachment.aspx?noattach=true&rid=' + flashGuid + '">
 +
<embed src="../../Attachments/GetAttachment.aspx?noattach=true&rid=' + flashGuid + '" quality="high"
 +
width="' + flashWidth + '" height="' + flashHeight +  '" name="dragDropDartboardFlash"
 +
pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash">
 +
</embed></object></p>';
  
 
// Modify the question after the DOM has finished loading to get jQuery access
 
// Modify the question after the DOM has finished loading to get jQuery access
Line 86: Line 103:
 
       {
 
       {
 
         // Create an instance of the drag drop dartboard  
 
         // Create an instance of the drag drop dartboard  
         var myDragDropDartboard =
+
         var myDragDropDartboard = new DragDropDartboard(quest, 'D_ImagePositions', [{{D_ImagePositions}}]);
              new DragDropDartboard(quest, flashGuid, 'D_ImagePositions', [{{D_ImagePositions}}], 500, 400);
 
 
          
 
          
         // Do some configuration
+
 
myDragDropDartboard.config.dartboard.fontColor = '000000';
+
         // Do some configuration by enter value you want
myDragDropDartboard.config.dartboard.fontSize = '15';
+
myDragDropDartboard.config.imageThumbnailConfiguration.imageHeight = 60;
myDragDropDartboard.config.dartboard.fontText = 'Arial';
+
myDragDropDartboard.config.imageThumbnailConfiguration.imageWidth = 60;
myDragDropDartboard.config.dartboard.oddColor = '865000';
+
myDragDropDartboard.config.imageThumbnailConfiguration.imageSpace = 10;
myDragDropDartboard.config.dartboard.evenColor = 'FFAA00';
+
myDragDropDartboard.config.dartboard.borderColor = '000000';  
+
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 drop dartboard  
 
         // Initalize the drag drop dartboard  
Line 158: Line 179:
 
// Enter the GUID for the Flash attachment
 
// Enter the GUID for the Flash attachment
 
var flashGuid = '216db971-5f3a-4179-9999-bd4831e160a4';
 
var flashGuid = '216db971-5f3a-4179-9999-bd4831e160a4';
 +
 +
// Enter the dimension for the Flash
 +
var flashWidth = 500;
 +
var flashHeight = 400;
 +
 +
// Insert the flash
 +
quest.text += '<p><object width="' + flashWidth + '" height="' + flashHeight +  '" id="dragDropDartboardFlash"
 +
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0">
 +
<param name="quality" value="high">
 +
<param name="movie" value="../../Attachments/GetAttachment.aspx?noattach=true&rid=' + flashGuid + '">
 +
<embed src="../../Attachments/GetAttachment.aspx?noattach=true&rid=' + flashGuid + '" quality="high"
 +
width="' + flashWidth + '" height="' + flashHeight +  '" name="dragDropDartboardFlash"
 +
pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash">
 +
</embed></object></p>';
  
 
// Modify the question after the DOM has finished loading to get jQuery access
 
// Modify the question after the DOM has finished loading to get jQuery access
Line 168: Line 203:
 
       {
 
       {
 
         // Create an instance of the drag drop dartboard  
 
         // Create an instance of the drag drop dartboard  
         var myDragDropDartboard =
+
         var myDragDropDartboard = new DragDropDartboard(quest, 'D_ImagePositions', [{{D_ImagePositions}}]);
            new DragDropDartboard(quest, flashGuid, 'D_ImagePositions', [{{D_ImagePositions}}], 500, 400);
 
 
          
 
          
         // Do some configuration
+
         // Do some configuration by enter value you want
myDragDropDartboard.config.dartboard.fontColor = '000000';
+
myDragDropDartboard.config.imageThumbnailConfiguration.imageHeight = 60;
myDragDropDartboard.config.dartboard.fontSize = '15';
+
myDragDropDartboard.config.imageThumbnailConfiguration.imageWidth = 60;
myDragDropDartboard.config.dartboard.fontText = 'Arial';
+
myDragDropDartboard.config.imageThumbnailConfiguration.imageSpace = 10;
myDragDropDartboard.config.dartboard.oddColor = '865000';
+
myDragDropDartboard.config.dartboard.evenColor = 'FFAA00';
+
myDragDropDartboard.config.dartboard.fontColor = '000000';
myDragDropDartboard.config.dartboard.borderColor = '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 drop dartboard  
 
         // Initalize the drag drop dartboard  

Latest revision as of 03:05, 18 October 2013

<accesscontrol>Main:MyGroup</accesscontrol>

Drag drop dartboard question view

The Drag drop dartboard question view transforms a scale grid question into a dartboard where sub questions, which must be specified as images, can be dragged into to the dartboard with level specified from min and max value.

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 'Dragdrop dartboard' below the folder 'Question views' if it doesn't exist already, leave inheritance on

5. Open the attachment tab of the 'Dragdrop dartboard' folder and upload the two files DragDropDartboard.js and DragDropDartboard.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' using Internet Explorer

7. Search by name for 'DragDropDartboard' anywhere in name, given that you named the attachments according to the suggested naming in the step above

8. Select the attachment from the list, press Ctrl-C, open a text editor such as Notepad, paste the value from the clipboard, get the GUID out of it (this feature will not work in other browsers except Internet Explorer)

Example: 369734,65b8671f-6e47-4ec5-9a7b-205c71908fb0<img src=notype.gif></img> Common resources\Question Views\DragDropDartboard Fri May 14 12:44:04 UTC+0700 2010 Hjarnaa, Ulrik (ulrikhjarnaa) Fri May 14 12:44:04 UTC+0700 2010 Hjarnaa, Ulrik (ulrikhjarnaa) Fri May 14 12:44:04 UTC+0700 2010 Hjarnaa, Ulrik (ulrikhjarnaa) 9.104 KB 36685371 DragDropDartboard

9. You should extract the GUIDs only, note them down now together with their filename, you will need it for setting up the question:
DragDropDartboard.js: 65b8671f-6e47-4ec5-9a7b-205c71908fb0
DragDropDartboard.swf: 216db971-5f3a-4179-9999-bd4831e160a4

10. Create a group called 'Drag drop dartboard access' under the folder 'Drag drop dartboard'

11. Give the group 'Drag drop dartboard access' observer access to the folder 'Drag drop dartboard'

12. Add the user with username 'anonymous' to the group 'Drag drop dartboard access', this is necessary for test links and anonymous access to work

13. All respondents participating in questionnaires using the DragDropDartboard 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.

Beside that, we need one more dummy question with Open type to store the position of images inside dartboard.

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', 'Flash GUID' with those GUIDs you found in the previous section, keep the quotes. And change 'D_ImagePositions' to the label name of dummy question you created. You can insert the images from the questionnaire editor, they should be uploaded to the questionnaire template then inserted into the sub questions. And you can edit some flash view configuration as you need (size of flash, pictures size, dartboard ring color,...).

QUESTIONNAIRE
[
	HTML=true;
	CLOSE_BUTTON_VISIBLE = false;
	NEXT_BUTTON_VISIBLE = true;
	REQUIRED = true;
	RESET_BUTTON_VISIBLE = false;
	BACK_BUTTON_VISIBLE = true;
]

QUESTION DartboardDragDrop SCALEGRID
[
JAVA_SCRIPT = "
// 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';

// Enter the dimension for the Flash 
var flashWidth = 500;
var flashHeight = 400;

// Insert the flash
quest.text += '<p><object width="' + flashWidth + '" height="' + flashHeight +  '" id="dragDropDartboardFlash"
 classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0">
<param name="quality" value="high">
<param name="movie" value="../../Attachments/GetAttachment.aspx?noattach=true&rid=' + flashGuid + '">
<embed src="../../Attachments/GetAttachment.aspx?noattach=true&rid=' + flashGuid + '" quality="high"
 width="' + flashWidth + '" height="' + flashHeight +  '" name="dragDropDartboardFlash" 
pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash">
</embed></object></p>';

// 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 myDragDropDartboard = new DragDropDartboard(quest, 'D_ImagePositions', [{{D_ImagePositions}}]);
         

        // Do some configuration by enter value you want
	myDragDropDartboard.config.imageThumbnailConfiguration.imageHeight = 60;
	myDragDropDartboard.config.imageThumbnailConfiguration.imageWidth = 60;
	myDragDropDartboard.config.imageThumbnailConfiguration.imageSpace = 10;
	
	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 drop dartboard 
         myDragDropDartboard.init();
      }
   );
};";
]
<p> How do you feel about these brands? </p>
SQ:[
REVERSE = false;
MAX_TEXT = "Like";
MIN_TEXT = "Hate";
MIN_VALUE = 1;
MAX_VALUE = 8;
DISCRETE = false;
STEP = 1;
REQUIRED = true;
]<img width="61" height="62" style="border: 0" src="path to image 1">
SQ:[
REVERSE = false;
MIN_VALUE = 1;
MAX_VALUE = 8;
DISCRETE = false;
STEP = 1;
]<img width="61" height="62" style="border: 0" src="path to image 2">
SQ:[
REVERSE = false;
MIN_VALUE = 1;
MAX_VALUE = 8;
DISCRETE = false;
STEP = 1;
REQUIRED = true;
]<img width="61" height="62" style="border: 0" src="path to image 3">
SQ:[
REVERSE = false;
MIN_VALUE = 1;
MAX_VALUE = 8;
DISCRETE = false;
STEP = 1;
]<img width="61" height="62" style="border: 0" src="path to image 4">
SQ:[
REVERSE = false;
MIN_VALUE = 1;
MAX_VALUE = 8;
DISCRETE = false;
STEP = 1;
]<img width="61" height="62" style="border: 0" src="path to image 5">

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';

// Enter the dimension for the Flash 
var flashWidth = 500;
var flashHeight = 400;

// Insert the flash
quest.text += '<p><object width="' + flashWidth + '" height="' + flashHeight +  '" id="dragDropDartboardFlash"
 classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0">
<param name="quality" value="high">
<param name="movie" value="../../Attachments/GetAttachment.aspx?noattach=true&rid=' + flashGuid + '">
<embed src="../../Attachments/GetAttachment.aspx?noattach=true&rid=' + flashGuid + '" quality="high"
 width="' + flashWidth + '" height="' + flashHeight +  '" name="dragDropDartboardFlash" 
pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash">
</embed></object></p>';

// 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 myDragDropDartboard = new DragDropDartboard(quest, 'D_ImagePositions', [{{D_ImagePositions}}]);
         
        // Do some configuration by enter value you want
	myDragDropDartboard.config.imageThumbnailConfiguration.imageHeight = 60;
	myDragDropDartboard.config.imageThumbnailConfiguration.imageWidth = 60;
	myDragDropDartboard.config.imageThumbnailConfiguration.imageSpace = 10;
		
	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 drop dartboard 
         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.