Drafts:SurveyManager Stargate Project

From RiskWiki
Jump to: navigation, search

Bishop Phillips BPC SurveyManager Wiki Mode

Introduction

In the wiki mode, the SM engine enables a freeflowing survey creation, viewing and responding environment. Just as some pages in a wiki might be protected from editing, some surveys a user sees are protected from change while others are not. Thos protected from change may allow data change (but not layout/content change) or disallow even data change (but allow viewing mode change between reporting modes (or not even that).


Components

The SM Wiki has:

  • an enhanced WYSIWYG editor to that can display entire survey elements.
  • an enhanced layout engine capable of working with tags that embedd an expanded set of survey element and meta tags supporting the LGROUP attribute extension
  • an emhanced layout scripting engine capable of working with the LGROUP attributes
  • an expanded rules engine capable of manipulatinng active LGROUPs.


LGROUPs

The LGROUP attribute of markup tags describes to which layout groups the element belongs. One or more layout groups can be specified with a comma separated list.



Thoughts

Define a survey layout like this (no #SurveyBody Tag):



<#survey UVW LGROUP="1,2" DEFLGROUP=1 >  //Defines a survey that maps the active LGROUP to 1 if it is default 
                                         //(the starting position with no questions and no initialised LGROUP.
<#survey XYZ LGROUP=3 >  //Defines a survey that will only work on LGROUP 3

 <#startsurvey UVW LGROUP="1,2" >  //Issue start survey layout if active LGROUP is 1 or 2
 <#question a LGROUP=1 >  //Display this question if active LGROUP is 1
 <#question b LGROUP=1 >
 <#question c LGROUP="1" >
 <#question aa LGROUP=2 >  //Display this question if active LGROUP is 2
 <#question ab LGROUP=2 >
 <#question ac LGROUP=2 >
 <#questiongroup g1 LGROUP=2 >  // Display a question group (generates a qlist and implies a surveybody tag? )
 <#endsurvey UVW LGROUP="1,2" >  //Requiring LGROUPS in the in an endsurvey tag allows the survey end to be shifted for different LGROUPS (or even omitted)
 <#startsurvey XYZ LGROUP=3,normal > 
 <#question ba LGROUP=3,normal >  //Display this question if active LGROUP is 3 or normal
 <#question bb LGROUP=3,normal >
 <#question bc LGROUP=3,normal >
 <#question bX LGROUP=2 >  // This should be an error condition - but how can we detect it, when it might also be ok (such as where info only is displayed).
 <#endsurvey XYZ LGROUP=3  >
 <#surveybody LGROUP=normal >
 <#endsurvey XYZ LGROUP=normal  > //Survey end moved for normal LGROUP



Now add the LGROUP to the QScript:

@{1,2,3}

or

@{default} //Sets to the default LGROUP (which is remapped to 1 in the above script) if no active LGROUP (otherwise use the one supplied @{* of {default, 1, 2, 3}} //Sets to the default LGROUP (which is remapped to 1 in the above script) if no active LGROUP (otherwise uses the one after the active one in the list

@( iferror( {LGROUP}, if( in(LGROUP,{default, 1}), {1}, if( GT(.a.Value, 88), if( notempty(QLIST), {normal} , next( if(LGROUP={normal}, PREVLGROUP, LGROUP), {default, 1, 2, 3}), { 1 } ) ) )}

This reads "if active LGROUP is one of default or 1, then show all tags with LGROUP 1, else if the value answered for the current user and survey question a is greater than 88, then if there are rule generated questions show those questions in the current QLIST else find the next active LGROUP to either the previous LGROUP if the Active LGROUP is "normal", or else the currently active LGROUP from an ordered list of LGROUPS and display tags matching that LGROUP." The QLIST is displayed by the <#surveybody LGROUP=normal > which only shows when the normal group is active. In the absence of a surveybody tag the layout tags act as an additional filter, because only those tags in the layout and in the QLIST will display. In the event of an error in an input page (such as the when a required question is ommitted, we must redisplay the current active LGROUP, and the current QLIST.


Question: Should we allow LGROUP to be a list (rather than a single item).