Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/LimeSurvey/LimeSurvey
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Dec 2, 2016
2 parents 6c9d1a4 + d072069 commit f411c32
Show file tree
Hide file tree
Showing 514 changed files with 4,684 additions and 111,641 deletions.
6 changes: 3 additions & 3 deletions application/config/config-defaults.php
Expand Up @@ -336,9 +336,9 @@

$config['pdfdefaultfont'] = 'auto'; //Default font for the pdf Export
/**
* $alternatepdffontfile - array of the font file name used to created pdf in statistics in specific language - this font are included in tcpdf core
* $alternatepdffontfile - array of the font file name used to created pdf in statistics in specific langage - this font are included in tcpdf core
* Only used if $pdfdefaultfont is set to auto or set to a PDF core fonts
* Some language are not tested : need translation for Yes,No and Gender : ckb, swh
* Some langage are not tested : need translation for Yes,No and Gender : ckb, swh
*/
$config['alternatepdffontfile']=array(
'ar'=>'dejavusans',// 'dejavusans' work but maybe more characters in aealarabiya or almohanad: but then need a dynamic font size too
Expand Down Expand Up @@ -407,7 +407,7 @@
*/
$config['chartfontfile']='auto';
/**
* $alternatechartfontfile - array of the font file name used to created the charts in statistics in specific language - this font must reside in <limesurvey root folder>/fonts
* $alternatechartfontfile - array of the font file name used to created the charts in statistics in specific langage - this font must reside in <limesurvey root folder>/fonts
* Only used if $chartfontfile is set to auto. If font file doesn't exist in <limesurvey root folder>/fonts, an alert is sent to admin
*/
$config['alternatechartfontfile']=array(
Expand Down
11 changes: 1 addition & 10 deletions application/config/third_party.php
Expand Up @@ -268,6 +268,7 @@
'Uri.js'
),
),

'bootstrap-datetimepicker' => array(
'basePath' => 'third_party.bootstrap-datetimepicker',
'css' => array(
Expand Down Expand Up @@ -297,16 +298,6 @@
'moment'
)
),

'fancytree' => array(
'basePath' => 'third_party.fancytree',
'js' => array(
'dist/jquery.fancytree-all.js'
),
'css' => array(
'dist/skin-bootstrap-ls/ui.fancytree.css'
),
),

'jquery-datatable' => array(
'basePath' => 'third_party.jquery-datatable',
Expand Down
6 changes: 3 additions & 3 deletions application/controllers/admin/limereplacementfields.php
Expand Up @@ -25,9 +25,9 @@ public function index()
{
throw new CHttpException(401);
}
list($replacementFields, $isInstertAnswerEnabled) = $this->_getReplacementFields($fieldtype, $surveyid);
list($replacementFields, $isInsertAnswerEnabled) = $this->_getReplacementFields($fieldtype, $surveyid);

if ($isInstertAnswerEnabled === true)
if ($isInsertAnswerEnabled === true)
{
//2: Get all other questions that occur before this question that are pre-determined answer types
$fieldmap = createFieldMap($surveyid,'full',false,false,getBaseLanguageFromSurveyID($surveyid));
Expand Down Expand Up @@ -132,7 +132,7 @@ private function _shouldAddQuestion($action, $gid, $qid, array $question, $previ
return false;
}
return true;
case 'emailtemplates':
case 'editemailtemplates':
// this is the case for email-conf
return true;
default:
Expand Down
162 changes: 0 additions & 162 deletions application/controllers/admin/questiongroups.php
Expand Up @@ -506,168 +506,6 @@ public function update($gid)
}
}


/**
* Generate the json array for question explorer tree.
* Fancy Tree is waiting for a unindexed array (no count)
* So we must build an array without index ($jDatas) and export it as Json
* For readability, we first build an indexed array ($aDatas)
*
* @see: http://php.net/manual/en/function.json-encode.php#example-4325 (Non-associative array output as array)
* @see: https://github.com/mar10/fancytree/wiki/TutorialLoadData#pass-a-javascript-array
*
* @param int $surveyid
* @param string $language
* @return string (json array)
*/
public function getGroupExplorerDatas($surveyid, $language)
{
$iSurveyID = (int) $surveyid;
$aGroups = QuestionGroup::model()->getGroupExplorerDatas($iSurveyID, $language); // Get an array of Groups and questions
$aDatas = array(); // The indexed array

// Two task :
// Clean the datas (ellipsize etc)
foreach($aGroups as $aGroup)
{
$aGroupArray = array();

$aGroupArray["key"] = $aGroup->gid; // The key is used by fancy tree to build the node id.
$aGroupArray["gid"] = $aGroup->gid;
$aGroupArray["title"] = $aGroup->sanitized_group_name; //shortening the name is a css thing now
$aGroupArray["folder"] = true; // Means it's a node with children
$aGroupArray["href"] = Yii::app()->createUrl('admin/questiongroups/sa/view/', array('surveyid' => $iSurveyID, 'gid' => $aGroup->gid)); // Means it's a node with children
$aGroupArray['extraClasses'] = 'lsi-tree-group-item';
$aGroupArray['buttonlinks'] = array(
"add" => array(
'title' => gT('Add a question to this group'),
'url' => Yii::app()->createUrl('admin/questions/sa/newquestion/', array('surveyid' => $iSurveyID, 'gid' => $aGroup->gid)),
'icon' => 'fa fa-plus-circle',
'toggle' => 'tooltip',
'cssclasses' => 'btn btn-xs btn-success',

),
"delete" => array(
'title' => gT('Delete this Group'),
'url' => Yii::app()->createUrl('admin/questiongroups/sa/delete/', array('surveyid' => $iSurveyID, 'gid' => $aGroup->gid)),
'icon' => 'fa fa-trash-o',
'toggle' => 'modal',
'target' => '#confirmation-modal',
'cssclasses' => 'btn btn-xs btn-danger deleteNode'
),
"edit" => array(
'title' => gT('Edit this group'),
'url' => Yii::app()->createUrl('admin/questiongroups/sa/edit/', array('surveyid' => $iSurveyID, 'gid' => $aGroup->gid)),
'icon' => 'fa fa-edit',
'toggle' => 'tooltip',
'cssclasses' => 'btn btn-xs btn-default',
),
);

foreach ($aGroup['aQuestions'] as $oQuestion)
{
$aDatasQuestions = array(); // The indexed array that will contain questions
$aDatasQuestions["key"] = $oQuestion->qid;
$aDatasQuestions["gid"] = $aGroup->gid;
$aDatasQuestions["title"] = "[".$oQuestion->sanitized_title . ']&nbsp;' . $oQuestion->sanitized_question;
$aDatasQuestions['href'] = Yii::app()->createUrl('admin/questions/sa/view/', array('surveyid' => $surveyid, 'gid' => $aGroup->gid, 'qid' => $oQuestion->qid));
$aDatasQuestions['toggle'] = 'tooltip';
$aDatasQuestions['placement'] = 'bottom';
$aDatasQuestions['extraClasses'] = 'lsi-tree-question-item';
$aDatasQuestions['buttonlinks'] = array(
"delete" => array(
'title' => gT('Delete this Question'),
'url' => Yii::app()->createUrl('admin/questions/sa/delete/', array('surveyid' => $iSurveyID, 'qid' => $oQuestion->qid)),
'icon' => 'fa fa-trash-o',
'toggle' => 'modal',
'target' => '#confirmation-modal',
'cssclasses' => 'btn btn-xs btn-danger deleteNode',
),
"edit" => array(
'title' => gT('Edit this group'),
'url' => Yii::app()->createUrl('admin/questions/sa/editquestion/', array('surveyid' => $iSurveyID, 'qid' => $oQuestion->qid)),
'icon' => 'fa fa-edit',
'toggle' => 'tooltip',
'cssclasses' => 'btn btn-xs btn-default',
),
);

$aGroupArray["children"][] = $aDatasQuestions; // Doing that, we push the questions in the children array, as an unindexed array (no count)
}
// Doing that, we push the Group as an unindexed array to jDatas, !IMPORTANT! don't index the jDatas array
$jDatas[] = $aGroupArray;
}

echo json_encode($jDatas);
}

function getQuestionDetailData($surveyid, $language, $gid=null, $qid=null){
$iSurveyID = (int) $surveyid;
if($qid === null){
$jDetailsArray = $this->collectQuestionGroupDetail($surveyid, $language, $gid);
} else {
$jDetailsArray = $this->collectQuestionDetail($surveyid, $language, $qid);
}

echo json_encode($jDetailsArray);
Yii::app()->end();
}
private function collectQuestionGroupDetail($surveyid, $language, $gid){

$oQuestionGroup = QuestionGroup::model()->findByPk(array('gid' => $gid, 'language' => $language));
$jDetailsArray = array(print_r($oQuestionGroup,true));
$jDetailContent = "<div class='container-center'>
<dl>
<dt>".gT('Description')."</dt>
<dd class='text-right'>&nbsp;".$oQuestionGroup->getGroupDescription($gid,$language)."</dd>
<dt>".gT('Questions')."</dt>
<dd class='text-right'>&nbsp;".$oQuestionGroup->questionsInGroup."</dd>
<dt>".gT('Randomization Group')."</dt>
<dd class='text-right'>&nbsp;".$oQuestionGroup->randomization_group."</dd>
<dt>".gT('Relevance')."</dt>
<dd class='text-right'>&nbsp;".LimeExpressionManager::UnitTestConvertConditionsToRelevance($surveyid,$oQuestionGroup->gid)."</dd>
</dl>";

$jDetailsArray = array(
'success' => true,
'title' => "<p style='white-space: pre-wrap; word-wrap:break-word;'>".$oQuestionGroup->sanitized_group_name."</p>",
'content' => $jDetailContent
);
return $jDetailsArray;
}
private function collectQuestionDetail($surveyid, $language, $qid){

$oQuestion = Question::model()->findByPk(array('qid' => $qid, 'language' => $language));
LimeExpressionManager::ProcessString("{" . $oQuestion->relevance . "}", $qid);
$jDetailContent = "<div class='container-center'>
<dl>
<dt>".gT('Code')."</dt>
<dd class='text-right'>&nbsp;".$oQuestion->sanitized_title."</dd>
<dt>".gT('Question type')."</dt>
<dd class='text-right'>&nbsp;".$oQuestion->typedesc."</dd>
<dt>".gT('Mandatory')."</dt>
<dd class='text-right'>&nbsp;".$oQuestion->mandatoryIcon."</dd>
<dt>".gT('Other')."</dt>
<dd class='text-right'>&nbsp;".$oQuestion->otherIcon."</dd>
<dt>".gT('Relevance equation')."</dt>
<dd class='text-right'>&nbsp;".LimeExpressionManager::GetLastPrettyPrintExpression()."</dd>
</dl>";

$jDetailsArray = array(
'success' => true,
'title' => "<p style='white-space: pre-wrap; word-wrap:break-word;'>".$oQuestion->sanitized_question."</p>",
'content' => $jDetailContent
);
return $jDetailsArray;
}
/**
* Renders template(s) wrapped in header and footer
*
Expand Down
1 change: 0 additions & 1 deletion application/controllers/admin/questions.php
Expand Up @@ -2099,5 +2099,4 @@ protected function abortIfSurveyIsActive(array $surveyInfo)
$this->getController()->redirect(Yii::app()->request->urlReferrer);
}
}

}
2 changes: 1 addition & 1 deletion application/controllers/survey/index.php
Expand Up @@ -121,7 +121,7 @@ function action()
$sOldLang=isset($_SESSION['survey_'.$surveyid]['s_lang'])?$_SESSION['survey_'.$surveyid]['s_lang']:"";// Keep the old value, because SetSurveyLanguage update $_SESSION
if (!empty($param['lang']))
{
$sDisplayLanguage = $param['lang'];// $param take lang from returnGlobal and returnGlobal sanitize languagecode
$sDisplayLanguage = $param['lang'];// $param take lang from returnGlobal and returnGlobal sanitize langagecode
}
elseif (isset($_SESSION['survey_'.$surveyid]['s_lang']))
{
Expand Down
5 changes: 1 addition & 4 deletions application/core/Survey_Common_Action.php
Expand Up @@ -872,7 +872,6 @@ function _surveybar($aData)
{
$sAlternativeUrl = $aData['surveybar']['closebutton']['url'];
$aData['surveybar']['closebutton']['url'] = Yii::app()->request->getUrlReferrer( Yii::app()->createUrl($sAlternativeUrl));

}

if($aData['gid']==null)
Expand Down Expand Up @@ -927,7 +926,6 @@ function _surveysidemenu($aData)
}

// Question explorer
/*
$aGroups = QuestionGroup::model()->findAllByAttributes(array('sid' => $iSurveyID, "language" => $sumresult1->defaultlanguage->surveyls_language),array('order'=>'group_order ASC'));
if(count($aGroups))
{
Expand All @@ -944,9 +942,8 @@ function _surveysidemenu($aData)
}
}
}
*/
$aData['quickmenu'] = $this->renderQuickmenu($aData);
$aData['aGroups'] = QuestionGroup::model()->getGroupExplorerDatas($iSurveyID, $sumresult1->defaultlanguage->surveyls_language);
$aData['aGroups'] = $aGroups;
$aData['surveycontent'] = Permission::model()->hasSurveyPermission($aData['surveyid'], 'surveycontent', 'read');
$aData['surveycontentupdate'] = Permission::model()->hasSurveyPermission($aData['surveyid'], 'surveycontent', 'update');
$aData['sideMenuBehaviour'] = getGlobalSetting('sideMenuBehaviour');
Expand Down
12 changes: 6 additions & 6 deletions application/helpers/admin/htmleditor_helper.php
Expand Up @@ -231,12 +231,12 @@ function getInlineEditor($fieldtype,$fieldname,$fieldtext, $surveyID=null,$gID=n
}
}

if ( $fieldtype == 'email-inv' ||
$fieldtype == 'email-reg' ||
$fieldtype == 'email-conf'||
$fieldtype == 'email-admin-notification'||
$fieldtype == 'email-admin-resp'||
$fieldtype == 'email-rem' )
if ( $fieldtype == 'email-invitation' ||
$fieldtype == 'email-registration' ||
$fieldtype == 'email-confirmation'||
$fieldtype == 'email-admin_notification'||
$fieldtype == 'email-admin_detailed_notification'||
$fieldtype == 'email-reminder' )
{
$htmlformatoption = ",fullPage:true\n";
}
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/export_helper.php
Expand Up @@ -608,7 +608,7 @@ function buildXMLFromQuery($xmlwriter, $Query, $tagname='', $excludes = array())
if (!$xmlwriter->startElement($Key)) safeDie('Invalid element key: '.$Key);
// Remove invalid XML characters
if ($Value!=='') {
$Value=str_replace(']]>','',$Value);
$Value=str_replace(']]>',']] >',$Value);
$xmlwriter->writeCData(preg_replace('/[^\x9\xA\xD\x20-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]/u','',$Value));
}
$xmlwriter->endElement();
Expand Down
1 change: 0 additions & 1 deletion application/models/AdminTheme.php
Expand Up @@ -388,7 +388,6 @@ public static function getOtherAssets()
// Third party assets
'third_party/jquery-tablesorter/tests/assets',
'third_party/jquery-tablesorter/docs/assets',
'third_party/fancytree'
);
}

Expand Down

0 comments on commit f411c32

Please sign in to comment.