1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 12:20:44 +02:00

FAQ fixes/enhancements

This commit is contained in:
Cameron
2015-05-29 17:14:09 -07:00
parent 51c7c67947
commit 6efbb4ab33
4 changed files with 42 additions and 10 deletions

View File

@@ -222,6 +222,8 @@ class faq_main_ui extends e_admin_ui
'add_faq' => array('title'=> LANA_FAQ_PREF_1, 'type'=>'userclass' ),
'submit_question' => array('title'=> LANA_FAQ_PREF_2, 'type'=>'userclass' ),
'submit_question_limit' => array('title'=> "'Ask a Question' limit per user", 'type'=>'number', 'data'=>'int', 'help'=>'0 = no limit'),
'submit_question_acknowledgement' => array('title'=> "Submitted Questions Acknowledgement", 'type'=>'textarea', 'help'=>'Leave blank to use default' ),
'classic_look' => array('title'=> LANA_FAQ_PREF_3, 'type'=>'boolean' ),
'list_type' => array('title'=> "List Type", 'type'=>'dropdown', 'writeParms'=>array('ul'=>'Unordered List', 'ol'=>'Ordered List') ),
'page_title' => array('title'=> "Page Title", 'type'=>'text', 'help'=>'Leave blank to use default' ),

View File

@@ -229,7 +229,8 @@ class faq
if($sql->insert('faqs',$insert))
{
e107::getMessage()->addSuccess('Thank you. Your question has been saved and will be answered as soon as possible.');
$message = !empty($this->pref['submit_question_acknowledgement']) ? e107::getParser()->toHtml($this->pref['submit_question_acknowledgement'],true, 'BODY') : 'Thank you. Your question has been saved and will be answered as soon as possible.'; //TODO LAN
e107::getMessage()->addSuccess($message);
}
}
@@ -264,8 +265,15 @@ class faq
$ret['title'] = FAQLAN_FAQ;
$ret['text'] = $text;
$ret['caption'] = varset($template['caption']) ? $tp->parseTemplate($template['caption'], true, $this->sc) : LAN_PLUGIN_FAQS_FRONT_NAME;
if (!empty($this->pref['page_title']))
{
$ret['caption'] = e107::getParser()->toHtml($this->pref['page_title'], true, 'TITLE');
}
else
{
$ret['caption'] = varset($template['caption']) ? $tp->parseTemplate($template['caption'], true, $this->sc) : LAN_PLUGIN_FAQS_FRONT_NAME;
}
return $ret;

View File

@@ -45,7 +45,7 @@ class faqs_shortcodes extends e_shortcode
$faqNew = ($this->var['faq_datestamp'] > $newDate) ? " faq-new" : "";
if($param == 'expand')
if($param == 'expand' && !empty($this->var['faq_answer']))
{
$tags = '';
if(vartrue($params['tags']) && $this->var['faq_tags'])
@@ -53,6 +53,9 @@ class faqs_shortcodes extends e_shortcode
$tags = "<div class='faq-tags'>".LAN_FAQS_TAGS.": ".$this->sc_faq_tags()."</div>";
}
$id = "faq_".$this->var['faq_id'];
$text = "<a class='e-expandit faq-question{$faqNew}' href='#{$id}'>".$tp->toHTML($this->var['faq_question'],true,'TITLE')."</a>
<div id='{$id}' class='e-hideme faq-answer faq_answer clearfix {$faqNew}'>".$tp->toHTML($this->var['faq_answer'],true,'BODY').$tags."</div>
";
@@ -60,7 +63,7 @@ class faqs_shortcodes extends e_shortcode
}
else
{
$text = $tp->toHTML($this->var['faq_question'],true, 'TITLE');
$text = $tp->toHTML($this->var['faq_question'],true, 'BODY');
}
return $text;
}
@@ -169,6 +172,13 @@ class faqs_shortcodes extends e_shortcode
return e107::getUrl()->create('faqs/list/all', array('category' => $this->var['faq_info_id']));
}
function sc_faq_datestamp($parm)
{
$type = vartrue($parm, 'relative');
return e107::getParser()->toDate($this->var['faq_datestamp'], $type);
}
function sc_faq_caption()
{
@@ -206,17 +216,29 @@ class faqs_shortcodes extends e_shortcode
return "<img src='".e_PLUGIN_ABS."faq/images/faq.png' alt='' />";
}
function sc_faq_submit_question()
function sc_faq_submit_question($parms)
{
$faqpref = e107::pref('faqs');
if(!empty($parms['expand']))
{
$hide = 'e-hideme';
$button = "<a class='btn btn-primary e-expandit faq-submit-question' href='#form-ask-a-question'>Ask a Question</a>";
}
else
{
$hide = "";
$button = "";
}
if (check_class($faqpref['submit_question']))
{
$frm = e107::getForm();
$text = "<a class='btn btn-primary e-expandit faq-submit-question' href='#ask-a-question'>Ask a Question</a>
<div id='ask-a-question' class='alert alert-info alert-block e-hideme form-group faq-submit-question-form'>";
$text = $button;
$text .= "<div id='form-ask-a-question' class='alert alert-info alert-block ".$hide." form-group faq-submit-question-form'>";
$text .= $frm->open('faq-ask-question','post');

View File

@@ -9,7 +9,7 @@
*/
$FAQS_TEMPLATE['start'] = "
<div class='faq-start'>{FAQ_SUBMIT_QUESTION}
<div class='faq-start'>{FAQ_SUBMIT_QUESTION: expand=1}
{FAQ_SUBMIT_QUESTION_LIST}
";