1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

character limit option added to FAQs "ask a question".

This commit is contained in:
Cameron
2016-10-06 14:48:35 -07:00
parent 9f381be882
commit 4ac0cea664
3 changed files with 17 additions and 4 deletions

View File

@@ -243,8 +243,8 @@ class faq_main_ui extends e_admin_ui
'add_faq' => array('title'=> LANA_FAQ_PREF_1, 'tab'=>0, 'type'=>'userclass' ),
'submit_question' => array('title'=> LANA_FAQ_PREF_2, 'tab'=>0, 'type'=>'userclass' ),
'submit_question_limit' => array('title'=> "'Ask a Question' limit per user", 'tab'=>0, 'type'=>'number', 'data'=>'int', 'help'=>'0 = no limit'),
'submit_question_char_limit' => array('title'=> "'Ask a Question' character limit", 'tab'=>0, 'type'=>'number', 'data'=>'int', 'help'=>'0 = no limit', 'writeParms'=>array('max'=>255, 'default'=>255)),
'submit_question_language' => array('title'=> "'Ask a Question' limited to", 'tab'=>0,'type'=>'dropdown' ),
'submit_question_acknowledgement' => array('title'=> "Submitted Questions Acknowledgement", 'type'=>'textarea', 'help'=>'Leave blank to use default' ),
'classic_look' => array('title'=> LANA_FAQ_PREF_3,'tab'=>0, 'type'=>'boolean' ),

View File

@@ -75,3 +75,6 @@ li.faq-listall-loop {
padding: 10px;
border-radius: 5px;
}
.faq-char-limit { text-align:right }

View File

@@ -27,11 +27,14 @@ class faqs_shortcodes extends e_shortcode
public $item = false;
private $share = false;
private $datestamp = false;
private $questionCharLimit = 255;
function __construct()
public function __construct()
{
$pref = e107::pref('faqs');
if(!empty($pref['display_social']) && e107::isInstalled('social')==true)
{
$this->share = true;
@@ -41,6 +44,12 @@ class faqs_shortcodes extends e_shortcode
{
$this->datestamp = true;
}
if(!empty($pref['submit_question_char_limit']))
{
$this->questionCharLimit = intval($pref['submit_question_char_limit']);
}
}
// Simply FAQ count when needed.
@@ -287,8 +296,9 @@ class faqs_shortcodes extends e_shortcode
if(check_class($faqpref['submit_question']))
{
$text .= $frm->open('faq-ask-question','post');
$text .= "<div>".$frm->textarea('ask_a_question','',3, 80 ,array('maxlength'=>255, 'size'=>'xxlarge','placeholder'=>'Type your question here..', 'wrap'=>'soft')).'<br />'.$frm->submit('submit_a_question','Submit')."</div>";
//TODO LAN ie. [x] character limit.
$text .= "<div>".$frm->textarea('ask_a_question','',3, 80 ,array('maxlength'=>$this->questionCharLimit, 'size'=>'xxlarge','placeholder'=>'Type your question here..', 'wrap'=>'soft'))."
<div class='faq-char-limit'><small>".$this->questionCharLimit." character limit</small></div>".$frm->submit('submit_a_question','Submit')."</div>";
$text .= $frm->close();
}