2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Merged from McMasterReports branch

This commit is contained in:
azammitdcarf
2010-01-14 07:45:37 +00:00
parent 18dbb16138
commit d1b139d315
1884 changed files with 555891 additions and 364768 deletions

View File

@@ -10,7 +10,7 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: conditions.php 3736 2007-11-30 16:13:55Z lemeur $
* $Id: fck_LimeReplacementFields.php 7161 2009-06-22 19:13:21Z lemeur $
*/
include_once("login_check.php");
@@ -32,19 +32,30 @@ $InsertansUnsupportedtypes=Array(); // Currently all question types are supporte
$replFields=Array();
$isInstertansEnabled=false;
$limereplacementoutput=""
. "<script language=\"javascript\">\n"
. "var oEditor = window.parent.InnerDialogLoaded() ;\n"
. "var dialog = oEditor.FCK ;\n"
. "var FCKLang = oEditor.FCKLang ;\n"
. "var FCKLimeReplacementFieldss = oEditor.FCKLimeReplacementFieldss ;\n"
. "window.onload = function ()\n"
. "{\n"
. "\toEditor.FCKLanguageManager.TranslatePage( document ) ;\n"
. "\tLoadSelected() ;\n"
. "\twindow.parent.SetOkButton( true ) ;\n"
. "}\n"
$limereplacementoutput="<html>\n"
. "\t<head>\n"
. "\t\t<title>LimeReplacementFields</title>\n"
. "\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"
. "\t\t<meta content=\"noindex, nofollow\" name=\"robots\">\n"
. "\t\t<script src=\"$fckeditordir/editor/dialog/common/fck_dialog_common.js\" type=\"text/javascript\"></script>\n"
. "\t\t<script src=\"$rooturl/scripts/jquery/jquery.js\" type=\"text/javascript\"></script>\n"
. "\t\t<script language=\"javascript\">\n"
. "\t\t\tvar mydialog = window.parent ;\n"
. "\t\t\tvar oEditor = mydialog.InnerDialogLoaded() ;\n"
. "\t\t\tvar dialog = oEditor.FCK ;\n"
. "\t\t\tvar FCKLang = oEditor.FCKLang ;\n"
. "\t\t\tvar FCKLimeReplacementFieldss = oEditor.FCKLimeReplacementFieldss ;\n"
. "\t\t\$(document).ready(function ()\n"
. "\t\t\t{\n"
. "\t\t\t\toEditor.FCKLanguageManager.TranslatePage( document ) ;\n"
. "\t\t\t\tLoadSelected() ;\n"
. "\t\t\t\tmydialog.SetOkButton( true ) ;\n"
. "\n"
. "\t\t\t\tSelectField( 'cquestions' ) ;\n"
. "\t\t\t});\n"
. "\n";
/**$limereplacementoutput="\n"
. "if (! oEditor.FCKBrowserInfo.IsIE)\n"
. "{\n"
. "\tinnertext = '' + dialog.EditorWindow.getSelection() + '' ;\n"
@@ -52,39 +63,70 @@ $limereplacementoutput=""
. "else\n"
. "{\n"
. "\tinnertext = '' + dialog.EditorDocument.selection.createRange().text + '' ;\n"
. "}\n"
. "\n"
. "function Ok()\n"
. "{\n"
. "\tvar sValue = document.getElementById('cquestions').value ;\n"
. "\tFCKLimeReplacementFieldss.Add( sValue ) ;\n"
. "\treturn true ;\n"
. "}\n"
. "}\n";
**/
$limereplacementoutput .= ""
. "\t\t\tvar eSelected = dialog.Selection.GetSelectedElement() ;\n"
. "\n";
/**
$limereplacementoutput="\n"
. "function LoadSelected()\n"
. "{\n"
. "\tif ( innertext == '' )\n"
. "\t\treturn ;\n"
// . "\tif ( eSelected.tagName == 'SPAN' && eSelected._fckLimeReplacementFields )\n"
. "var replcode=innertext.substring(innertext.indexOf('{')+1,innertext.lastIndexOf('}'));\n"
// . "alert('TIBO=' + replcode);\n"
. "\t\tdocument.getElementById('cquestions').value = replcode;\n"
// . "\telse\n"
// . "\t\teSelected == null ;\n"
. "}\n"
. "</script>\n";
. "}\n";
**/
$limereplacementoutput .= ""
. "\t\t\tfunction LoadSelected()\n"
. "\t\t\t{\n"
. "\t\t\t\tif ( !eSelected )\n"
. "\t\t\t\t\treturn ;\n"
. "\t\t\t\tif ( eSelected.tagName == 'SPAN' && eSelected._fckLimeReplacementFields )\n"
. "\t\t\t\t\t document.getElementById('cquestions').value = eSelected._fckLimeReplacementFields ;\n"
. "\t\t\t\telse\n"
. "\t\t\t\t\teSelected == null ;\n"
. "\t\t\t}\n";
$limereplacementoutput .= "<table><tr><td>";
$limereplacementoutput .= ""
. "\t\t\tfunction Ok()\n"
. "\t\t\t{\n"
. "\t\t\t\tvar sValue = document.getElementById('cquestions').value ;\n"
. "\t\t\t\tFCKLimeReplacementFieldss.Add( sValue ) ;\n"
. "\t\t\t\treturn true ;\n"
. "\t\t\t}\n";
$limereplacementoutput .= ""
. "\t\t\t</script>\n"
. "\t\t</head>\n";
$limereplacementoutput .= "\t<body scroll=\"no\" style=\"OVERFLOW: hidden\">\n"
. "\t\t<table height=\"100%\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" border=\"0\">\n"
. "\t\t\t<tr>\n"
. "\t\t\t\t<td>\n";
switch ($fieldtype)
{
case 'survey-desc':
case 'survey-welc':
case 'survey-endtext':
$replFields[]=array('TOKEN:FIRSTNAME',$clang->gT("Firstname from token"));
$replFields[]=array('TOKEN:LASTNAME',$clang->gT("Lastname from token"));
$replFields[]=array('TOKEN:EMAIL',$clang->gT("Email from the token"));
$replFields[]=array('TOKEN:ATTRIBUTE_1',$clang->gT("Attribute_1 from token"));
$replFields[]=array('TOKEN:ATTRIBUTE_2',$clang->gT("Attribute_2 from token"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array('TOKEN:'.strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('EXPIRY',$clang->gT("Survey expiration date (YYYY-MM-DD)"));
$replFields[]=array('EXPIRY-DMY',$clang->gT("Survey expiration date (DD-MM-YYYY)"));
$replFields[]=array('EXPIRY-MDY',$clang->gT("Survey expiration date (MM-DD-YYYY)"));
break;
case 'email-inv':
@@ -99,11 +141,17 @@ switch ($fieldtype)
$replFields[]=array('LASTNAME',$clang->gT("Lastname from token"));
$replFields[]=array('SURVEYNAME',$clang->gT("Name of the survey"));
$replFields[]=array('SURVEYDESCRIPTION',$clang->gT("Description of the survey"));
$replFields[]=array('ATTRIBUTE_1',$clang->gT("Attribute_1 from token"));
$replFields[]=array('ATTRIBUTE_2',$clang->gT("Attribute_2 from token"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array(strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('ADMINNAME',$clang->gT("Name of the survey administrator"));
$replFields[]=array('ADMINEMAIL',$clang->gT("Email address of the survey administrator"));
$replFields[]=array('SURVEYURL',$clang->gT("URL of the survey"));
$replFields[]=array('EXPIRY',$clang->gT("Survey expiration date (YYYY-MM-DD)"));
$replFields[]=array('EXPIRY-DMY',$clang->gT("Survey expiration date (DD-MM-YYYY)"));
$replFields[]=array('EXPIRY-MDY',$clang->gT("Survey expiration date (MM-DD-YYYY)"));
break;
case 'group-desc':
@@ -112,10 +160,21 @@ switch ($fieldtype)
$replFields[]=array('TOKEN:FIRSTNAME',$clang->gT("Firstname from token"));
$replFields[]=array('TOKEN:LASTNAME',$clang->gT("Lastname from token"));
$replFields[]=array('TOKEN:EMAIL',$clang->gT("Email from the token"));
$replFields[]=array('TOKEN:ATTRIBUTE_1',$clang->gT("Attribute_1 from token"));
$replFields[]=array('TOKEN:ATTRIBUTE_2',$clang->gT("Attribute_2 from token"));
$attributes=GetTokenFieldsAndNames($surveyid,true);
foreach ($attributes as $attributefield=>$attributedescription)
{
$replFields[]=array('TOKEN:'.strtoupper($attributefield), sprintf($clang->gT("Token attribute: %s"),$attributedescription));
}
$replFields[]=array('EXPIRY',$clang->gT("Survey expiration date (YYYY-MM-DD)"));
$replFields[]=array('EXPIRY-DMY',$clang->gT("Survey expiration date (DD-MM-YYYY)"));
$replFields[]=array('EXPIRY-MDY',$clang->gT("Survey expiration date (MM-DD-YYYY)"));
case 'editanswer':
$isInstertansEnabled=true;
break;
case 'assessment-text':
$replFields[]=array('TOTAL',$clang->gT("Overall assessment score"));
$replFields[]=array('PERC',$clang->gT("Assessment group score"));
break;
}
@@ -178,6 +237,7 @@ if ($isInstertansEnabled===true)
}
break;
case 'editanswer':
case 'copyquestion':
case 'editquestion':
if (empty($gid)) {die("No GID provided.");}
@@ -314,6 +374,40 @@ if ($isInstertansEnabled===true)
} //while
} //if A,B,C,E,F,H
elseif ($rows['type'] == ":" || $rows['type'] == ";") // Multiflexi
{
//Get the LIDs
$fquery = "SELECT * "
."FROM {$dbprefix}labels "
."WHERE lid={$rows['lid']} "
."AND language='".GetBaseLanguageFromSurveyID($surveyid)."' "
."ORDER BY sortorder, code ";
$fresult = db_execute_assoc($fquery);
while ($frow=$fresult->FetchRow())
{
$lids[$frow['code']]=$frow['title'];
}
//Now cycle through the answers
$aquery="SELECT * "
."FROM {$dbprefix}answers "
."WHERE qid={$rows['qid']} "
."AND {$dbprefix}answers.language='".GetBaseLanguageFromSurveyID($surveyid)."' "
."ORDER BY sortorder, "
."answer";
$aresult=db_execute_assoc($aquery) or safe_die ("Couldn't get answers to Array questions<br />$aquery<br />".$connect->ErrorMsg());
while ($arows = $aresult->FetchRow())
{
$shortanswer = strip_tags($arows['answer']);
$shortanswer .= " [{$arows['code']}]";
foreach($lids as $key=>$val)
{
$cquestions[]=array("$shortquestion [$shortanswer [$val]] ", $rows['qid'], $rows['type'], $rows['sid'].$X.$rows['gid'].$X.$rows['qid'].$arows['code']."_".$key,$rows['previouspage']);
}
}
} //TIBO
elseif ($rows['type'] == "R") //Answer Ranking
{
$aquery="SELECT * "
@@ -396,30 +490,33 @@ if ($isInstertansEnabled===true)
if (count($replFields) > 0 || isset($cquestions) )
{
$limereplacementoutput .= "\t\t\t<select name='cquestions' id='cquestions' style='font-family:verdana; background-color: #FFFFFF; font-size:10; border: 0px;width:99%;' size='15' ondblclick='Ok();'>\n";
$limereplacementoutput .= "\t\t\t\t\t<select name='cquestions' id='cquestions' style='font-family:verdana; background-color: #FFFFFF; font-size:10; border: 0px;width:99%;' size='15' ondblclick='Ok();'>\n";
$noselection = false;
}
else
{
$limereplacementoutput = $clang->gT("No replacement variable available for this field");
echo $limereplacementoutput;
return;
$limereplacementoutput .= $clang->gT("No replacement variable available for this field");
//echo $limereplacementoutput;
//return;
$noselection = true;
}
if (count($replFields) > 0)
{
$limereplacementoutput .= "\t\t\t\t<optgroup label='".$clang->gT("Standard Fields")."'>\n";
$limereplacementoutput .= "\t\t\t\t\t\t<optgroup label='".$clang->gT("Standard Fields")."'>\n";
foreach ($replFields as $stdfield)
{
$limereplacementoutput .= "\t\t\t\t<option value='".$stdfield[0]."'";
$limereplacementoutput .= "\t\t\t\t\t\t\t<option value='".$stdfield[0]."'";
$limereplacementoutput .= ">".$stdfield[1]."</option>\n";
}
$limereplacementoutput .= "\t\t\t\t</optgroup>\n";
$limereplacementoutput .= "\t\t\t\t\t\t</optgroup>\n";
}
if (isset($cquestions))
{
$limereplacementoutput .= "\t\t\t\t<optgroup label='".$clang->gT("Previous Answers Fields")."'>\n";
$limereplacementoutput .= "\t\t\t\t\t\t<optgroup label='".$clang->gT("Previous Answers Fields")."'>\n";
foreach ($cquestions as $cqn)
{
$isDisabled="";
@@ -432,36 +529,53 @@ if (isset($cquestions))
$isDisabled=" disabled='disabled'";
}
$limereplacementoutput .= "\t\t\t\t<option value='INSERTANS:$cqn[3]'";
$limereplacementoutput .= "\t\t\t\t\t\t\t<option value='INSERTANS:$cqn[3]'";
$limereplacementoutput .= " $isDisabled >$cqn[0]</option>\n";
}
$limereplacementoutput .= "\t\t\t\t</optgroup>\n";
$limereplacementoutput .= "\t\t\t\t\t\t</optgroup>\n";
}
$limereplacementoutput .= "\t\t\t</select>\n";
$limereplacementoutput .= "</td></tr>\n";
if ($noselection === false)
{
$limereplacementoutput .= "\t\t\t\t\t</select>\n";
}
$limereplacementoutput .= "\t\t\t\t</td>\n"
. "\t\t\t</tr>\n";
if (isset($surveyformat))
{
switch ($surveyformat)
{
case 'A':
$limereplacementoutput .= "<tr><td>\n";
$limereplacementoutput .= "<br /><font color='orange'>".$clang->gT("Some Question have been disabled")."</font>";
$limereplacementoutput .= "<br />".sprintf($clang->gT("Survey Format is %s:"), $clang->gT("All in one"))."<br /><i>".$clang->gT("Only Previous pages answers are available")."</i><br />";
$limereplacementoutput .= "</td></tr>\n";
$limereplacementoutput .= "\t\t\t<tr>\n"
. "\t\t\t\t<td>\n";
$limereplacementoutput .= "\t\t\t\t\t<br />\n"
. "\t\t\t\t\t<font color='orange'>".$clang->gT("Some Question have been disabled")."</font>\n";
$limereplacementoutput .= "\t\t\t\t\t<br />\n"
. "\t\t\t\t\t".sprintf($clang->gT("Survey Format is %s:"), $clang->gT("All in one"))
. "\t\t\t\t\t<br />\n"
. "\t\t\t\t\t<i>".$clang->gT("Only Previous pages answers are available")."</i>\n"
. "\t\t\t\t\t<br />\n";
$limereplacementoutput .= "\t\t\t\t</td>\n"
. "\t\t\t</tr>\n";
break;
case 'G':
$limereplacementoutput .= "<tr><td>\n";
$limereplacementoutput .= "<br /><font color='orange'>".$clang->gT("Some Question have been disabled")."</font>";
$limereplacementoutput .= "<br />".sprintf($clang->gT("Survey mode is set to %s:"), $clang->gT("Group by Group"))."<br/><i>".$clang->gT("Only Previous pages answers are available")."</i><br />"; $limereplacementoutput .= "</td></tr>\n";
$limereplacementoutput .= "\t\t\t<tr>\n"
. "\t\t\t\t<td>\n";
$limereplacementoutput .= "\t\t\t\t\t<br /><font color='orange'>".$clang->gT("Some Question have been disabled")."</font>";
$limereplacementoutput .= "<br />".sprintf($clang->gT("Survey mode is set to %s:"), $clang->gT("Group by Group"))."<br/><i>".$clang->gT("Only Previous pages answers are available")."</i><br />";
$limereplacementoutput .= "\t\t\t\t</td>\n"
. "\t\t\t</tr>\n";
break;
}
}
$limereplacementoutput .= "</table>\n";
$limereplacementoutput .= "\t\t</table>\n"
. "\t</body>\n"
. "</html>";
echo $limereplacementoutput;
exit;
?>