mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
#5123 - FAQ make AaQ field required and add min char limit
Needs additional fix in form_handler to support minlength attribute for textarea
This commit is contained in:
@@ -238,6 +238,7 @@ class faq_main_ui extends e_admin_ui
|
||||
'submit_question' => array('title'=> LANA_FAQ_PREF_2, 'tab'=>1, 'type'=>'userclass' ),
|
||||
'submit_question_limit' => array('title'=> LANA_FAQ_PREF_4, 'tab'=>1, 'type'=>'number', 'data'=>'int', 'help'=>LANA_FAQ_PREF_HELP_1),
|
||||
'submit_question_char_limit'=> array('title'=> LANA_FAQ_PREF_5, 'tab'=>1, 'type'=>'number', 'data'=>'int', 'help'=>LANA_FAQ_PREF_HELP_1, 'writeParms'=>array('max'=>255, 'default'=>255)),
|
||||
'submit_question_char_min'=> array('title'=> LANA_FAQ_PREF_24, 'tab'=>1, 'type'=>'number', 'data'=>'int', 'help'=>LANA_FAQ_PREF_HELP_1, 'writeParms'=> array('default'=> 20)),
|
||||
'submit_question_language' => array('title'=> LANA_FAQ_PREF_6, 'tab'=>1, 'type'=>'dropdown' ),
|
||||
'submit_question_acknowledgement'=> array('title'=> LANA_FAQ_PREF_7, 'tab'=>1, 'type'=>'textarea', 'help'=>LANA_FAQ_PREF_HELP_2),
|
||||
//new display tab
|
||||
|
@@ -30,6 +30,7 @@ class faqs_shortcodes extends e_shortcode
|
||||
private $share = false;
|
||||
private $datestamp = false;
|
||||
private $questionCharLimit = 255;
|
||||
private $questionCharMin = 20;
|
||||
public $pref;
|
||||
public $tag;
|
||||
public $category;
|
||||
@@ -55,6 +56,11 @@ class faqs_shortcodes extends e_shortcode
|
||||
$this->questionCharLimit = intval($pref['submit_question_char_limit']);
|
||||
}
|
||||
|
||||
if(!empty($pref['submit_question_char_min']))
|
||||
{
|
||||
$this->questionCharMin = intval($pref['submit_question_char_min']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Simply FAQ count when needed.
|
||||
@@ -331,7 +337,7 @@ class faqs_shortcodes extends e_shortcode
|
||||
{
|
||||
$text .= $frm->open('faq-ask-question','post');
|
||||
//TODO LAN ie. [x] character limit.
|
||||
$text .= "<div>".$frm->textarea('ask_a_question','',3, 80 ,array('maxlength' =>$this->questionCharLimit, 'size' =>'xxlarge', 'placeholder' =>LAN_FAQS_012, 'wrap' =>'soft'))."
|
||||
$text .= "<div>".$frm->textarea('ask_a_question','',3, 80 ,array('required' => true, 'maxlength' => $this->questionCharLimit, 'minlength' => $this->questionCharMinLimit, 'size' =>'xxlarge', 'placeholder' =>LAN_FAQS_012, 'wrap' =>'soft'))."
|
||||
<div class='faq-char-limit'><small>".$this->questionCharLimit." ".LAN_FAQS_013."</small></div>".$frm->submit('submit_a_question',LAN_SUBMIT)."</div>";
|
||||
|
||||
$text .= $frm->close();
|
||||
|
@@ -40,6 +40,7 @@ define("LANA_FAQ_PREF_20", "Ascending by Date");
|
||||
define("LANA_FAQ_PREF_21", "Descending by Date");
|
||||
define("LANA_FAQ_PREF_22", "Manage Questions");
|
||||
define("LANA_FAQ_PREF_23", "Manage Categories");
|
||||
define("LANA_FAQ_PREF_24", "Ask a Question: character min length");
|
||||
|
||||
define("LANA_FAQ_PREF_HELP_1", "0 = no limit");
|
||||
define("LANA_FAQ_PREF_HELP_2", "Leave blank to use default");
|
||||
|
@@ -21,6 +21,8 @@
|
||||
<pref name="add_faq">255</pref>
|
||||
<pref name="submit_question">255</pref>
|
||||
<pref name="submit_question_limit">3</pref>
|
||||
<pref name="submit_question_char_limit">255</pref>
|
||||
<pref name="submit_question_char_min">20</pref>
|
||||
<pref name="classic_look">0</pref>
|
||||
<pref name="display_social">1</pref>
|
||||
<pref name="display_datestamp">1</pref>
|
||||
|
Reference in New Issue
Block a user