Skip to content

Commit

Permalink
Dev: fixed script loading in quanda_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Nov 14, 2017
1 parent d1bddef commit 34aa89b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
6 changes: 5 additions & 1 deletion application/config/packages.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
'question-ranking'=>array(
'devBaseUrl' => 'assets/packages/questions/ranking/',
'basePath' => 'core.questions.ranking',
'position' => CClientScript::POS_BEGIN,
'css'=> array(
'ranking.css',
),
Expand Down Expand Up @@ -131,8 +132,11 @@
'devBaseUrl' => 'assets/packages/pjax/',
'basePath' => 'core.pjax',
'js' => array(
'pjax.js',
'pjax'.$minVersion.'.js',
),
'depends' => array(
'es6promise'
)
),
'adminpanel' => array(
'devBaseUrl' => 'assets/packages/adminpanel/',
Expand Down
10 changes: 10 additions & 0 deletions application/config/third_party.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
'bootstrap-slider' => array(
'devBaseUrl' => 'assets/packages/bootstrap/plugins/slider',
'basePath' => 'core.bootstrap.plugins.slider',
'position' => CClientScript::POS_BEGIN,
'css'=> array(
'css/bootstrap-slider'.$minVersion.'.css'
),
Expand All @@ -85,6 +86,7 @@
'bootstrap-multiselect' => array(
'devBaseUrl' => 'assets/packages/bootstrap/plugins/multiselect',
'basePath' => 'core.bootstrap.plugins.multiselect',
'position' => CClientScript::POS_BEGIN,
'js' => array(
'js/bootstrap-multiselect.js',
),
Expand All @@ -101,6 +103,7 @@
'bootstrap-select2' => array(
'devBaseUrl' => 'assets/packages/bootstrap/plugins/select2',
'basePath' => 'core.bootstrap.plugins.select2',
'position' => CClientScript::POS_BEGIN,
'js' => array(
'js/select2.full'.$minVersion.'.js',
),
Expand All @@ -117,6 +120,7 @@
'bootstrap-datetimepicker' => array(
'devBaseUrl' => 'assets/packages/bootstrap/plugins/datetimepicker/build',
'basePath' => 'core.bootstrap.plugins.datetimepicker.build',
'position' => CClientScript::POS_BEGIN,
'css' => array(
'css/bootstrap-datetimepicker'.$minVersion.'.css'
),
Expand Down Expand Up @@ -245,6 +249,7 @@
// jQuery Table Sorter
'jquery-tablesorter' => array(
'basePath' => 'third_party.jquery-tablesorter',
'position' => CClientScript::POS_BEGIN,
'js' => array(
'jquery.tablesorter.min.js'
),
Expand All @@ -256,6 +261,7 @@
// jQuery NestedSortable
'jquery-nestedSortable' => array(
'basePath' => 'third_party.jquery-nestedSortable',
'position' => CClientScript::POS_BEGIN,
'js' => array(
'jquery.mjs.nestedSortable.js'
),
Expand Down Expand Up @@ -291,6 +297,7 @@
// jQuery selectboxes
'jquery-selectboxes' => array(
'basePath' => 'third_party.jquery-selectboxes.selectboxes',
'position' => CClientScript::POS_BEGIN,
'js' => array(
'jquery.selectboxes.js'
),
Expand Down Expand Up @@ -391,6 +398,7 @@
/* Used by ranking question type */
'rubaxa-sortable' => array(
'basePath' => 'third_party.rubaxa-sortable', /* for sorting ability */
'position' => CClientScript::POS_BEGIN,
'js' => array(
'jquery.fn.sortable'.$minVersion.'.js'
),
Expand All @@ -400,6 +408,7 @@
),
'jquery-actual' => array(
'basePath' => 'third_party.jquery-actual', /* for samechoiceheight/samelistheight */
'position' => CClientScript::POS_BEGIN,
'js' => array(
'jquery.actual.min.js'
),
Expand All @@ -410,6 +419,7 @@
/* Used by short text with map by leaflet */
'leaflet' => array(
'basePath' => 'third_party.leaflet',
'position' => CClientScript::POS_BEGIN,
'js' => array(
'leaflet.js'
),
Expand Down
26 changes: 13 additions & 13 deletions application/helpers/qanda_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ function do_date($ia)
);
App()->getClientScript()->registerScript("setDatePickerGlobalOption","$.extend( $.fn.datetimepicker.defaults, ".json_encode($aDefaultDatePicker)." )",CClientScript::POS_BEGIN);
}
App()->getClientScript()->registerScript("doPopupDate{$ia[0]}","doPopupDate({$ia[0]});",CClientScript::POS_END);
App()->getClientScript()->registerScript("doPopupDate{$ia[0]}","doPopupDate({$ia[0]});",LSYii_ClientScript::POS_POSTSCRIPT);
}
$inputnames[]=$ia[1];

Expand Down Expand Up @@ -2072,11 +2072,11 @@ function do_ranking($ia)
}
if(!App()->getClientScript()->isScriptRegistered("triggerEmRelevanceSortable")){
Yii::app()->getClientScript()->registerPackage("question-ranking");
App()->getClientScript()->registerScript("triggerEmRelevanceSortable","triggerEmRelevanceSortable()",CClientScript::POS_END);
App()->getClientScript()->registerScript("triggerEmRelevanceSortable","triggerEmRelevanceSortable()",LSYii_ClientScript::POS_POSTSCRIPT);
$rankingTranslation='LSvar.lang.rankhelp="'.gT("Double-click or drag-and-drop items in the left list to move them to the right - your highest ranking item should be on the top right, moving through to your lowest ranking item.",'js').'";';
App()->getClientScript()->registerScript("rankingTranslation",$rankingTranslation,CClientScript::POS_BEGIN);
}
App()->getClientScript()->registerScript("doDragDropRank{$ia[0]}","doDragDropRank({$ia[0]},{$aQuestionAttributes["showpopups"]},{$aQuestionAttributes["samechoiceheight"]},{$aQuestionAttributes["samelistheight"]})",CClientScript::POS_END);
App()->getClientScript()->registerScript("doDragDropRank{$ia[0]}","doDragDropRank({$ia[0]},{$aQuestionAttributes["showpopups"]},{$aQuestionAttributes["samechoiceheight"]},{$aQuestionAttributes["samelistheight"]})",LSYii_ClientScript::POS_POSTSCRIPT);

if(trim($aQuestionAttributes['choice_title'][App()->language]) != '')
{
Expand Down Expand Up @@ -2559,8 +2559,8 @@ function do_multiplechoice_withcomments($ia)

if($aQuestionAttributes['commented_checkbox']!="allways" && $aQuestionAttributes['commented_checkbox_auto'])
{
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."multiplechoice_withcomments.js");
Yii::app()->getClientScript()->registerScript("doMultipleChoiceWithComments{$ia[0]}","doMultipleChoiceWithComments({$ia[0]},'{$aQuestionAttributes["commented_checkbox"]}');",CClientScript::POS_END);
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."multiplechoice_withcomments.js", LSYii_ClientScript::POS_BEGIN);
Yii::app()->getClientScript()->registerScript("doMultipleChoiceWithComments{$ia[0]}","doMultipleChoiceWithComments({$ia[0]},'{$aQuestionAttributes["commented_checkbox"]}');",LSYii_ClientScript::POS_POSTSCRIPT);
}

return array($answer, $inputnames);
Expand Down Expand Up @@ -2614,7 +2614,7 @@ function upload_$ia[1]() {
var imageurl = '".Yii::app()->getConfig('imageurl')."';
var uploadurl = '".$scriptloc."';
</script>\n";
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."modaldialog.js");
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."modaldialog.js", LSYii_ClientScript::POS_BEGIN);
Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . "uploader-files.css");
// Modal dialog
//$answer .= $uploadbutton;
Expand Down Expand Up @@ -3252,7 +3252,7 @@ function do_multiplenumeric($ia)
$aJsonOptions=json_encode(array(
'slider_custom_handle'=>$slider_custom_handle
));
App()->getClientScript()->registerScript("doNumericSlider{$ia[0]}","doNumericSlider({$ia[0]},{$aJsonOptions})",CClientScript::POS_END);
App()->getClientScript()->registerScript("doNumericSlider{$ia[0]}","doNumericSlider({$ia[0]},{$aJsonOptions})",LSYii_ClientScript::POS_POSTSCRIPT);
}

return array($answer, $inputnames);
Expand Down Expand Up @@ -3610,8 +3610,8 @@ function do_shortfreetext($ia)
App()->getClientScript()->registerPackage('devbridge-autocomplete');/* for autocomplete */
Yii::app()->getClientScript()->registerScript('sGlobalMapScriptVar',"LSmap=".ls_json_encode($aGlobalMapScriptVar).";\nLSmaps= new Array();",CClientScript::POS_BEGIN);
Yii::app()->getClientScript()->registerScript('sThisMapScriptVar'.$ia[1],"LSmaps['{$ia[1]}']=".ls_json_encode($aThisMapScriptVar).";",CClientScript::POS_BEGIN);
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."map.js");
Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . 'map.css');
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."map.js",CClientScript::POS_END);
Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . 'map.css',CClientScript::POS_END);

if (isset($aQuestionAttributes['hide_tip']) && $aQuestionAttributes['hide_tip']==0)
{
Expand Down Expand Up @@ -5378,8 +5378,8 @@ function do_array_multiflexi($ia)
$coreRowClass .= " checkbox-list";
$caption .= gT("Please check the matching combinations.");
$textAlignment = 'center';
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."array-number-checkbox.js",CClientScript::POS_END);
App()->getClientScript()->registerScript("doArrayNumberCheckbox","doArrayNumberCheckbox();\n",CClientScript::POS_END);
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."array-number-checkbox.js",CClientScript::POS_BEGIN);
App()->getClientScript()->registerScript("doArrayNumberCheckbox","doArrayNumberCheckbox();\n",LSYii_ClientScript::POS_POSTSCRIPT);
}
elseif ($aQuestionAttributes['input_boxes']!=0 )
{
Expand Down Expand Up @@ -6302,8 +6302,8 @@ function do_array_dual($ia)
$answer = "<p class='error'>".gT("Error: There are no answer options for this question and/or they don't exist in this language.")."</p>\n";
$inputnames="";
}
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."dualscale.js", CClientScript::POS_END);
Yii::app()->getClientScript()->registerScript("doDualScaleFunction{$ia[0]}","{$doDualScaleFunction}({$ia[0]});",CClientScript::POS_END);
Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."dualscale.js", CClientScript::POS_BEGIN);
Yii::app()->getClientScript()->registerScript("doDualScaleFunction{$ia[0]}","{$doDualScaleFunction}({$ia[0]});",LSYii_ClientScript::POS_POSTSCRIPT);

return array($answer, $inputnames);
}
Expand Down

0 comments on commit 34aa89b

Please sign in to comment.