1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Merge pull request #2223 from MikeyGMT/20161230c

Text To LANS in FAQs #6
This commit is contained in:
Cameron 2016-12-31 10:12:38 -08:00 committed by GitHub
commit 673a6a0ece
5 changed files with 73 additions and 73 deletions

View File

@ -2,25 +2,16 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Copyright (C) 2008-2016 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
/**
*
* @package e107
* @subpackage faqs
* @author e107inc
*
* FAQ plugin admin UI
*/
require_once("../../class2.php");
e107::lan('faqs', 'admin',true);
//TODO LANS
class faq_admin extends e_admin_dispatcher
{
@ -42,7 +33,7 @@ class faq_admin extends e_admin_dispatcher
protected $adminMenu = array(
'main/list' => array('caption'=> LAN_MANAGE, 'perm' => 'P'),
'main/create' => array('caption'=> LAN_CREATE_ITEM, 'perm' => 'P'),
'main/pending' => array('caption'=> "Unanswered", 'perm' => 'P', 'uri'=>"admin_config.php?mode=main&action=list&filter=pending"),
'main/pending' => array('caption'=> LANA_FAQ_UNANSWERED, 'perm' => 'P', 'uri'=>"admin_config.php?mode=main&action=list&filter=pending"),
'cat/list' => array('caption'=> LAN_CATEGORIES, 'perm' => 'P'),
'cat/create' => array('caption'=> LAN_CREATE_CATEGORY, 'perm' => 'P'),
@ -216,54 +207,57 @@ class faq_main_ui extends e_admin_ui
//TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'faq_id' => array('title'=> LAN_ID, 'tab' => 0, 'type' => null, 'width' =>'5%', 'forced'=> TRUE),
'faq_id' => array('title'=> LAN_ID, 'tab' => 0, 'type' => null, 'width' =>'5%', 'forced'=> TRUE),
'faq_question' => array('title'=> LANA_FAQ_QUESTION, 'tab' => 0, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first', 'required'=>TRUE, 'readParms'=>'editable=1', 'writeParms'=>'maxlength=1000&size=block-level'),
'faq_answer' => array('title'=> LANA_FAQ_ANSWER, 'tab' => 0, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=1&truncate=50&bb=1'),
'faq_parent' => array('title'=> LAN_CATEGORY, 'tab' => 0, 'type' => 'dropdown', 'data'=> 'int', 'inline'=>true,'width' => '10%', 'filter'=>TRUE, 'batch'=>TRUE),
'faq_parent' => array('title'=> LAN_CATEGORY, 'tab' => 0, 'type' => 'dropdown', 'data'=> 'int', 'inline'=>true,'width' => '10%', 'filter'=>TRUE, 'batch'=>TRUE),
'faq_tags' => array('title'=> LANA_FAQ_TAGS, 'tab' => 1, 'type' => 'tags', 'data' => 'str', 'width' => 'auto', 'inline'=> true, 'help' => LANA_FAQ_TAGS_HELP), // User id
'faq_comment' => array('title'=> LANA_FAQ_COMMENT, 'tab' => 1, 'type' => 'userclass', 'data' => 'int', 'width' => 'auto', 'inline'=> true), // User id
'faq_comment' => array('title'=> LANA_FAQ_COMMENT, 'tab' => 1, 'type' => 'userclass', 'data' => 'int', 'width' => 'auto', 'inline'=> true), // user class who can make comments
'faq_datestamp' => array('title'=> LAN_DATE, 'tab' => 1, 'type' => 'datestamp', 'data'=> 'int','width' => 'auto', 'noedit' => false,'writeParms'=>'type=datetime&auto=1'),
'faq_author' => array('title'=> LAN_USER, 'tab' => 1, 'type' => 'user', 'data'=> 'int', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'writeParms' => 'currentInit=1', 'filter' => true, 'batch' => true, 'nolist' => true ), // Photo
'faq_author_ip' => array('title'=> LAN_IP, 'tab' => 1, 'type' => 'ip', 'readonly'=>2, 'data'=> 'str', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'writeParms' => 'currentInit=1', 'filter' => true, 'batch' => true, 'nolist' => true ), // Photo
'faq_datestamp' => array('title'=> LAN_DATE, 'tab' => 1, 'type' => 'datestamp', 'data'=> 'int','width' => 'auto', 'noedit' => false,'writeParms'=>'type=datetime&auto=1'),
'faq_author' => array('title'=> LAN_AUTHOR, 'tab' => 1, 'type' => 'user', 'data'=> 'int', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'writeParms' => 'currentInit=1', 'filter' => true, 'batch' => true, 'nolist' => true ), // Photo
'faq_author_ip' => array('title'=> LAN_IP, 'tab' => 1, 'type' => 'ip', 'readonly'=>2, 'data'=> 'str', 'width' => 'auto', 'thclass' => 'center', 'class'=>'center', 'writeParms' => 'currentInit=1', 'filter' => true, 'batch' => true, 'nolist' => true ), // Photo
'u.user_name' => array('title'=> LANA_FAQ_UNAME, 'tab' => 1, 'type' => 'user', 'width' => 'auto', 'noedit' => true, 'readParms'=>'idField=faq_author&link=1'), // User name
'u.user_loginname' => array('title'=> LANA_FAQ_ULOGINNAME, 'tab' => 1, 'type' => 'user', 'width' => 'auto', 'noedit' => true, 'readParms'=>'idField=faq_author&link=1'), // User login name
'faq_order' => array('title'=> LAN_ORDER, 'tab' => 1, 'type' => 'number', 'data'=> 'int','width' => '5%', 'thclass' => 'center','nolist' => false, 'noedit'=>false, 'readParms'=>'editable=1'),
'u.user_name' => array('title'=> LAN_USER, 'tab' => 1, 'type' => 'user', 'width' => 'auto', 'noedit' => true, 'readParms'=>'idField=faq_author&link=1'), // User name
'u.user_loginname' => array('title'=> LANA_FAQ_ULOGINNAME, 'tab' => 1, 'type' => 'user', 'width' => 'auto', 'noedit' => true, 'readParms'=>'idField=faq_author&link=1'), // User login name
'faq_order' => array('title'=> LAN_ORDER, 'tab' => 1, 'type' => 'number', 'data'=> 'int','width' => '5%', 'thclass' => 'center','nolist' => false, 'noedit'=>false, 'readParms'=>'editable=1'),
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center','readParms'=>array('sort'=>1)),
'pending' => array('title' => 'internal', 'type' => 'hidden', 'data'=>false, 'writeParms'=>array()),
'pending' => array('title' => 'internal', 'type' => 'hidden', 'data'=>false, 'writeParms'=>array()),
);
protected $fieldpref = array('checkboxes', 'faq_question', 'faq_answer', 'faq_parent', 'faq_datestamp', 'options');
protected $preftabs = array("General", LAN_ADMIN );
protected $preftabs = array(LAN_GENERAL, LAN_PLUGIN_FAQS_NAME , LAN_CATEGORIES);
// optional, if $pluginName == 'core', core prefs will be used, else e107::getPluginConfig($pluginName);
protected $prefs = array(
'add_faq' => array('title'=> LANA_FAQ_PREF_1, 'tab'=>0, 'type'=>'userclass' ),
'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_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' ),
'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' ),
'list_type' => array('title'=> "List Type", 'tab'=>0,'type'=>'dropdown', 'writeParms'=>array('ul'=>'Unordered List', 'ol'=>'Ordered List') ),
'page_title' => array('title'=> "Page Title", 'tab'=>0,'type'=>'text', 'multilan'=>true, 'help'=>'Leave blank to use default' ),
'new' => array('title'=> "'New' FAQs are no more than", 'tab'=>0,'type'=>'number', 'writeParms'=>'size=mini&default=0&post=days old', 'help'=>'Leave blank to use default' ),
'display_total' => array('title'=> "Display FAQ total", 'tab'=>0,'type'=>'boolean', 'data'=>'int' ),
'display_datestamp' => array('title'=> "Display Datestamp", 'tab'=>0,'type'=>'boolean', 'data'=>'int' ),
'classic_look' => array('title'=> LANA_FAQ_PREF_3, 'tab'=>0, 'type'=>'boolean' ),
'list_type' => array('title'=> "List Type", 'tab'=>0,'type'=>'dropdown', 'writeParms'=>array('ul'=>'Unordered List', 'ol'=>'Ordered List') ),
'page_title' => array('title'=> "Page Title", 'tab'=>0,'type'=>'text', 'multilan'=>true, 'help'=>'Leave blank to use default' ),
'new' => array('title'=> "'New' FAQs are no more than", 'tab'=>0,'type'=>'number', 'writeParms'=>'size=mini&default=0&post=days old', 'help'=>'Leave blank to use default' ),
'display_total' => array('title'=> "Display FAQ total", 'tab'=>0,'type'=>'boolean', 'data'=>'int' ),
'display_datestamp' => array('title'=> "Display Datestamp", 'tab'=>0,'type'=>'boolean', 'data'=>'int' ),
'display_social' => array('title'=> "Display Social buttons", 'tab'=>0,'type'=>'boolean', 'data'=>'int' ),
'orderby' => array('title'=> LAN_ORDER, 'tab'=>0,'type'=>'dropdown', 'writeParms'=>array('faq_order-ASC'=>"Specified Order", 'faq_id-ASC'=>'ID ASC', 'faq_id-DESC'=>'ID DESC', 'faq_datestamp-ASC'=>'Date ASC', 'faq_datestamp-DESC'=>'Date DESC')),
'orderby' => array('title'=> LAN_ORDER, 'tab'=>0,'type'=>'dropdown', 'writeParms'=>array('faq_order-ASC'=>"Specified Order", 'faq_id-ASC'=>'ID ASC', 'faq_id-DESC'=>'ID DESC', 'faq_datestamp-ASC'=>'Date ASC', 'faq_datestamp-DESC'=>'Date DESC')),
'admin_faq_create' => array('title'=> "Create FAQ", 'tab'=>1, 'type'=>'userclass', 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ),
'admin_faq_edit' => array('title'=> "Edit FAQ", 'tab'=>1, 'type'=>'userclass', 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ),
'admin_faq_delete' => array('title'=> "Delete FAQ", 'tab'=>1, 'type'=>'userclass', 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ),
'admin_faq_create' => array('title'=> LAN_CREATE_ITEM, 'tab'=>1, 'type'=>'userclass', 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ),
'admin_faq_edit' => array('title'=> LAN_EDIT, 'tab'=>1, 'type'=>'userclass', 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ),
'admin_faq_delete' => array('title'=> LAN_DELETE, 'tab'=>1, 'type'=>'userclass', 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ),
'admin_cat_create' => array('title'=> "Create Category", 'tab'=>1, 'type'=>'userclass' , 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ),
'admin_cat_edit' => array('title'=> "Edit Category", 'tab'=>1, 'type'=>'userclass' , 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ),
'admin_cat_delete' => array('title'=> "Delete category", 'tab'=>1, 'type'=>'userclass' , 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ),
'admin_cat_create' => array('title'=> LAN_CREATE_CATEGORY, 'tab'=>2, 'type'=>'userclass' , 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ),
'admin_cat_edit' => array('title'=> LAN_EDIT, 'tab'=>2, 'type'=>'userclass' , 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ),
'admin_cat_delete' => array('title'=> LAN_DELETE, 'tab'=>2, 'type'=>'userclass' , 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ),
);
protected $categories = array();

View File

@ -6,12 +6,8 @@
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* FAQ Core Plugin
*
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/faqs/faqs.php,v $
* $Revision$
* $Date$
* $Author$
*/
if (!defined('e107_INIT'))
@ -233,7 +229,7 @@ class faq
if(!empty($this->pref['submit_question_limit']) && $existing >= $this->pref['submit_question_limit'])
{
e107::getMessage()->setTitle('Sorry',E_MESSAGE_INFO)->addInfo("You have reached the maximum number of new questions. You may ask more once your existing questions have been answered.");
e107::getMessage()->setTitle(LAN_WARNING,E_MESSAGE_INFO)->addInfo(LAN_FAQS_LIMIT_REACHED);
return;
}
@ -333,7 +329,7 @@ class faq
$insert = " AND (f.faq_question LIKE '%".$srch."%' OR f.faq_answer LIKE '%".$srch."%' OR FIND_IN_SET ('".$srch."', f.faq_tags) ) ";
$message = "<span class='label label-lg label-info'>".$srch." <a class='e-tip' title='Remove' href='".$removeUrl."'>×</a></span>";
$message = "<span class='label label-lg label-info'>".$srch." <a class='e-tip' title='".LAN_FAQS_REMOVE."' href='".$removeUrl."'>×</a></span>";
e107::getMessage()->setClose(false,E_MESSAGE_INFO)->setTitle(LAN_FAQS_FILTER_ACTIVE,E_MESSAGE_INFO)->addInfo($message);
$text = e107::getMessage()->render();
@ -359,7 +355,7 @@ class faq
$insert = " AND FIND_IN_SET ('".$srch."', f.faq_tags) ";
$message = "<span class='label label-lg label-info'>".$srch." <a class='e-tip' title='Remove' href='".$removeUrl."'>×</a></span>";
$message = "<span class='label label-lg label-info'>".$srch." <a class='e-tip' title='".LAN_FAQS_REMOVE."' href='".$removeUrl."'>×</a></span>";
e107::getMessage()->setClose(false,E_MESSAGE_INFO)->setTitle(LAN_FAQS_FILTER_ACTIVE,E_MESSAGE_INFO)->addInfo($message);
$text = e107::getMessage()->render();
@ -372,8 +368,8 @@ class faq
if(!$data = $sql->retrieve($query, true))
{
$message = (!empty($srch)) ? "<b>".$srch."</b> was not found in search results. <a class='e-tip' title='Reset' href='".$removeUrl."'>Reset</a>" : LAN_FAQS_NONE_AVAILABLE;
return "<div class='alert alert-warning alert-block'>".$message."</div>" ; //TODO LAN
$message = (!empty($srch)) ? e107::getParser()->lanVars(LAN_FAQS_X_NOT_FOUND, $srch)."<a class='e-tip' title='".LAN_FAQS_RESET."' href='".$removeUrl."'>".LAN_FAQS_RESET."</a>" : LAN_FAQS_NONE_AVAILABLE;
return "<div class='alert alert-warning alert-block'>".$message."</div>" ;
}
// -----------------
@ -474,7 +470,7 @@ class faq
{
$sc->setVars($rw);
$text .= $tp->parseTemplate($FAQ_LIST_LOOP, true);
$caption = "&nbsp;Category: <b>".$rw['faq_info_title']."</b>";
$caption = "&nbsp;".LAN_CATEGORY.": <b>".$rw['faq_info_title']."</b>";
}
$text .= $tp->parseTemplate($FAQ_LIST_END, true);
@ -605,7 +601,7 @@ class faq
if (ADMIN && getperms("B"))
{
// bkwon 05-Jun-2004 fix URL to moderate comment
echo "<div style='text-align:right'><a href='".e_ADMIN."modcomment.php?faq.$faq_id'>moderate comments</a></div><br />";
echo "<div style='text-align:right'><a href='".e_ADMIN."modcomment.php?faq.$faq_id'>".LAN_FAQS_MODERATE_COMMENTS."</a></div><br />";
}
}
$cobj->form_comment($action, $table, $idx.".".$id, $subject, $content_type);
@ -618,10 +614,10 @@ class faq
{
global $faqpref,$timing_start,$tp,$cust_footer, $CUSTOMPAGES, $CUSTOMHEADER, $CUSTOMHEADER;
$text_menu .= "<div style='text-align:center;' ><br />
&nbsp;&nbsp;[&nbsp;<a href=\"faqs.php?main\">Back to Categories</a>&nbsp;]&nbsp;&nbsp;";
&nbsp;&nbsp;[&nbsp;<a href='".faqs.php?main."'>".LAN_FAQS_BACK_TO_CATEGORIES."</a>&nbsp;]&nbsp;&nbsp;";
if(check_class($faqpref['add_faq'])){
$text_menu .="[&nbsp;<a href=\"faqs.php?new.$id\">Submit a Question</a>&nbsp;]";
$text_menu .="[&nbsp;<a href='".faqs.php?new.$id."'>".LAN_FAQS_ASK_A_QUESTION."</a>&nbsp;]";
}
$text_menu .="</div>";
@ -649,7 +645,7 @@ class faq
<table class='fborder' style=\"width:100%\">
<tr>
<td class='fcaption' style=\"width:70%\">".FAQ_ADLAN_49."</td>
<td class='fcaption' style='text-align:center'>Options</td></tr>
<td class='fcaption' style='text-align:center'>".LAN_SETTINGS."</td></tr>
";
while ($rw = $sql->db_Fetch())
{
@ -681,8 +677,8 @@ class faq
<tr>
<td class='fcaption' colspan='2' style='text-align:center'>";
$text .= (is_numeric($id)) ? "Edit" : "Add";
$text .= " an FAQ</td></tr>";
$text .= (is_numeric($id)) ? LAN_EDIT : LAN_ADD; //LAN_ADD may not exist on the front end, but I dont think this code is used - Mikey.
$text .= " FAQ</td></tr>";
$text .= "
<tr>
@ -763,10 +759,10 @@ class faq
$row = $sql->db_Fetch();
extract($row);
}
$ns->tablerender("Frequently asked Questions".$faq_info_title, "<div style='text-align:center'>".$text."</div>".$this->faq_footer());
$ns->tablerender( LAN_PLUGIN_FAQS_FRONT_NAME.$faq_info_title, "<div style='text-align:center'>".$text."</div>".$this->faq_footer());
}
}
?>
?>

View File

@ -2,7 +2,7 @@
/*
* e107 website system
*
* Copyright (c) 2008-2013 e107 Inc (e107.org)
* Copyright (c) 2008-2016 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
@ -31,7 +31,7 @@ class faqs_setup
";
$status = ($sql->db_Select_gen($query)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Adding Default table data to table: faqs",$status);
$mes->add(LAN_DEFAULT_TABLE_DATA.": faqs", $status);
$query2 = "INSERT INTO #faqs_info (`faq_info_id`, `faq_info_title`, `faq_info_about`, `faq_info_parent`, `faq_info_class`, `faq_info_order`, `faq_info_icon`, `faq_info_metad`, `faq_info_metak`) VALUES
@ -40,7 +40,7 @@ class faqs_setup
";
$status = ($sql->db_Select_gen($query2)) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
$mes->add("Adding Default table data to table: faqs_info",$status);
$mes->add(LAN_DEFAULT_TABLE_DATA.": faqs_info", $status);
}
/*

View File

@ -5,13 +5,11 @@
*
* "FAQ plugin" admin-area language definitions
*/
define("LANA_FAQ_QUESTION", "Question");
define("LANA_FAQ_ANSWER", "Answer");
define("LANA_FAQ_COMMENT", "Comment"); //FIXME Use generic
define("LANA_FAQ_UNAME", "User name"); //FIXME Use generic
define("LANA_FAQ_UNANSWERED", "Unanswered");
define("LANA_FAQ_COMMENT", "Comment Class");
//define("LANA_FAQ_UNAME", "User name"); //LAN_USER
define("LANA_FAQ_ULOGINNAME", "User login"); //FIXME Use generic
define("LANA_FAQ_TAGS", "Tags");
define("LANA_FAQ_TAGS_HELP", "Comma separated tag list");

View File

@ -1,12 +1,24 @@
<?php
/*
* Copyright (c) e107 Inc 2008-2015 - e107.org,
* Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
*
* 'FAQ plugin' global language definitions
*/
/*
* e107 website system
*
* Copyright (C) 2008-2016 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* FAQ Plugin Global Language Definitions
*
*/
define("LAN_FAQS_TAGS", "Tags");
define("LAN_FAQS_FILTER_ACTIVE", "Filter Active");
define("LAN_FAQS_NONE_AVAILABLE", "There are currently no FAQs available.");
define("LAN_FAQS_ASKQUESTION_AFTER", "Thank you. Your question has been saved and will be answered as soon as possible.");
define("LAN_FAQS_LIMIT_REACHED", "You have reached the maximum number of new questions. You may ask more once your existing questions have been answered.");
define("LAN_FAQS_REMOVE", "Remove");
define("LAN_FAQS_RESET", "Reset");
define("LAN_FAQS_X_NOT_FOUND", "[x]: Not found in search results.");
define("LAN_FAQS_MODERATE_COMMENTS", "moderate comments");
define("LAN_FAQS_BACK_TO_CATEGORIES", "Back to Categories");
define("LAN_FAQS_ASK_A_QUESTION", "Ask a Question");
define("LAN_FAQS_FAQ", "FAQ");