From 6889d849aa0210ced2ce321258f3dffc4b7d97b2 Mon Sep 17 00:00:00 2001 From: Denis Chenu Date: Mon, 31 Oct 2016 17:57:44 +0100 Subject: [PATCH] Dev: issue #11734: Reimplement input size Dev: short text only actually --- .../core/packages/limesurvey/survey.css | 18 ++++-------------- application/helpers/qanda_helper.php | 13 ++++++++----- application/helpers/questionHelper.php | 12 +++++++++++- .../survey/Question/advanced_settings_view.php | 4 ++-- .../questions/shortfreetext/text/item.php | 6 +++--- .../questions/shortfreetext/textarea/item.php | 7 ++++--- 6 files changed, 32 insertions(+), 28 deletions(-) diff --git a/application/core/packages/limesurvey/survey.css b/application/core/packages/limesurvey/survey.css index ade709aaf55..f56a5d7e0f7 100644 --- a/application/core/packages/limesurvey/survey.css +++ b/application/core/packages/limesurvey/survey.css @@ -26,18 +26,6 @@ /* For relanceOnOff ? */ .ls-irrelevant {display: none !important;} -/* Todo : default asterisk : why not put directly inside ? -*/ -/* -.asterisk {} -.asterisk:before { - content: "\f069"; - display: inline-block; - font-family: FontAwesome; - font-size: inherit; - line-height:1; -} -*/ .form-horizontal .control-label.col-sm-12 { text-align: left; } @@ -63,7 +51,7 @@ border-collapse: separate; display: table; position: relative; - width:100%; +/* width:100%; */ } .ls-input-group .form-control { @@ -87,9 +75,11 @@ font-size: inherit;/* 1.4rem; BS use 10px for html and 14px for body */ font-weight: normal; line-height: 1; - text-align: center; border: 1px hidden transparent; } +.answer-item textarea[cols]{width:initial;max-width:100%} +.answer-item input[type='text'][size]{width:initial;max-width:100%} +.answer-item textarea[cols] + .ls-input-group-extra,.answer-item input[type='text'][size] + .ls-input-group-extra{width:initial} /* in inline form : width need to be auto */ .form-inline .ls-input-group{display: inline-table;vertical-align: middle;width:auto} diff --git a/application/helpers/qanda_helper.php b/application/helpers/qanda_helper.php index 9492eba9b9c..96f3534aaea 100644 --- a/application/helpers/qanda_helper.php +++ b/application/helpers/qanda_helper.php @@ -3463,9 +3463,8 @@ function do_shortfreetext($ia) if (intval(trim($aQuestionAttributes['maximum_chars']))>0) { // Only maxlength attribute, use textarea[maxlength] jquery selector for textarea - $maximum_chars = intval(trim($aQuestionAttributes['maximum_chars'])); - $maxlength = "maxlength='{$maximum_chars}' "; - $extraclass .=" maxchars maxchars-".$maximum_chars; + $maxlength = intval(trim($aQuestionAttributes['maximum_chars'])); + $extraclass .=" maxchars maxchars-".$maxlength; } else { @@ -3480,7 +3479,11 @@ function do_shortfreetext($ia) { $col = 12; /* Add a inline iof no col is set : see https://bugs.limesurvey.org/view.php?id=11734 too */ } - $inputsize=50; /* @todo : move it to attribute ? see https://bugs.limesurvey.org/view.php?id=11734 */ + if(ctype_digit(trim($aQuestionAttributes['input_size']))){ + $inputsize=trim($aQuestionAttributes['input_size']); + }else{ + $inputsize=null; + } if (trim($aQuestionAttributes['prefix'][$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']])!='') { $prefix = $aQuestionAttributes['prefix'][$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']]; @@ -3672,7 +3675,7 @@ function do_shortfreetext($ia) ); App()->getClientScript()->registerPackage('leaflet'); Yii::app()->getClientScript()->registerScript('sGlobalMapScriptVar',"LSmap=".ls_json_encode($aGlobalMapScriptVar).";\nLSmaps= new Array();",CClientScript::POS_HEAD); - Yii::app()->getClientScript()->registerScript('sThisMapScriptVar'.$ia[1],"LSmaps['{$ia[1]}']=".ls_json_encode($aThisMapScriptVar),CClientScript::POS_HEAD); + Yii::app()->getClientScript()->registerScript('sThisMapScriptVar'.$ia[1],"LSmaps['{$ia[1]}']=".ls_json_encode($aThisMapScriptVar).";",CClientScript::POS_HEAD); Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."map.js"); Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . 'map.css'); diff --git a/application/helpers/questionHelper.php b/application/helpers/questionHelper.php index 062d8dcb6d7..9076b23d15d 100644 --- a/application/helpers/questionHelper.php +++ b/application/helpers/questionHelper.php @@ -674,10 +674,20 @@ public static function getAttributesDefinitions() 'caption' => gT('Show grand total') ); + self::$attributes["input_size"]=array( + "types"=>"S", + 'category'=>gT('Display'), + 'sortorder'=>100, + 'inputtype'=>'integer', + 'default'=>'', + "help"=>gT("Set the size to the input or textarea, the input will be displayed with approximately this size in width."), + "caption"=>gT("Text input size") + ); + self::$attributes["input_boxes"]=array( "types"=>":", 'category'=>gT('Display'), - 'sortorder'=>100, + 'sortorder'=>110, 'inputtype'=>'switch', 'options'=>array(0=>gT('No'), 1=>gT('Yes')), diff --git a/application/views/admin/survey/Question/advanced_settings_view.php b/application/views/admin/survey/Question/advanced_settings_view.php index 916998bdfa4..dc101536bde 100644 --- a/application/views/admin/survey/Question/advanced_settings_view.php +++ b/application/views/admin/survey/Question/advanced_settings_view.php @@ -79,13 +79,13 @@ // Integer case 'integer':?> - ' name='' value='' /> + ' name='' value='' /> - ' name='' value='' /> + ' name='' value='' /> -
+
@@ -36,8 +36,8 @@ class="form-control text " name="" id="answer" value="" - - size="" + + /> diff --git a/application/views/survey/questions/shortfreetext/textarea/item.php b/application/views/survey/questions/shortfreetext/textarea/item.php index 5aee9f9bb86..7155d558877 100644 --- a/application/views/survey/questions/shortfreetext/textarea/item.php +++ b/application/views/survey/questions/shortfreetext/textarea/item.php @@ -11,6 +11,7 @@ * @var $checkconditionFunction $checkconditionFunction.'(this.value, this.name, this.type) * @var $dispVal */ +tracevar($maxlength); ?> @@ -22,7 +23,7 @@ -
+
@@ -34,8 +35,8 @@ class="form-control textarea " name="" id="" rows="" - cols="" - + + >