From 3fb9c5c0cca3851147f0e975e934ceb1833b3e1f Mon Sep 17 00:00:00 2001 From: MikeyGMT Date: Sun, 19 Mar 2017 21:11:56 +0000 Subject: [PATCH] Text To Lans - FAQs #6 Text to Lans - FAQs #6 FYI new Tab under Prefs > Display : makes the prefs neater on the page. --- e107_languages/English/admin/lan_admin.php | 7 +- e107_plugins/faqs/admin_config.php | 66 +++++++++---------- e107_plugins/faqs/e_cron.php | 24 ++++--- e107_plugins/faqs/faqs_shortcodes.php | 18 ++--- .../faqs/languages/English/English_admin.php | 24 +++++++ .../faqs/languages/English/English_front.php | 7 +- 6 files changed, 91 insertions(+), 55 deletions(-) diff --git a/e107_languages/English/admin/lan_admin.php b/e107_languages/English/admin/lan_admin.php index c1bb5e53d..869bf262d 100644 --- a/e107_languages/English/admin/lan_admin.php +++ b/e107_languages/English/admin/lan_admin.php @@ -305,6 +305,8 @@ define("LAN_WEBSITE_STATUS","Website Status"); define("LAN_STATS","Stats"); define("LAN_ONLINE","Online"); define("LAN_ORDER","Order"); +define("LAN_ASC","ASC"); +define("LAN_DESC","DESC"); define("LAN_SELECT","Select ..."); define("LAN_ADMIN","Admin"); @@ -348,8 +350,10 @@ define("LAN_DISABLED","Disabled"); define("LAN_ENABLED", "Enabled"); define("LAN_BOOL_REVERSE", "Invert"); +define("LAN_DETAILS", "Details"); define("LAN_NOT_AVAILABLE","Not available"); define("LAN_AUTO_GENERATED","Auto-generated"); +define("LAN_AUTOMATION","Automation"); define("LAN_PRESET_CONFIRMSAVE","Save current form values as the default for this page?"); define("LAN_CONFIGURE", "Configure"); @@ -418,7 +422,7 @@ define("LAN_END", "End"); define("LAN_PREVIEW", "Preview"); define("LAN_CREATE_CATEGORY", "Create Category"); -define("LAN_CREATE_ITEM", "Create Item"); +define("LAN_CREATE_ITEM", "Create Item"); define("LAN_SECURITYL_0", "Looking for trouble (none)"); @@ -489,6 +493,7 @@ define("LAN_LIMIT", "Limit"); define("LAN_BASIC", "Basic"); define("LAN_EXTENDED", "Extended"); define("LAN_ADVANCED", "Advanced"); +define("LAN_DISPLAY", "Display"); define("LAN_FOLDER", "Folder"); define("LAN_PERSONALIZE_ICONS", "Personalize Icons"); define("LAN_PERSONALIZE_MENUS", "Personalize Menus"); diff --git a/e107_plugins/faqs/admin_config.php b/e107_plugins/faqs/admin_config.php index 4ac9dd3b4..b129d77e1 100644 --- a/e107_plugins/faqs/admin_config.php +++ b/e107_plugins/faqs/admin_config.php @@ -50,7 +50,7 @@ class faq_admin extends e_admin_dispatcher 'main/edit' => 'main/list' ); - protected $menuTitle = 'FAQs'; + protected $menuTitle = LAN_PLUGIN_FAQS_NAME; // function init() @@ -109,7 +109,7 @@ class faq_cat_ui extends e_admin_ui { $sql = e107::getDb(); - $this->categories[0] = "(Root)"; + $this->categories[0] = "(".LAN_ROOT.")"; if($sql->select('faqs_info','*', 'faq_info_parent = 0 ORDER BY faq_info_title ASC')) { @@ -183,7 +183,7 @@ class faq_cat_form_ui extends e_admin_form_ui class faq_main_ui extends e_admin_ui { - protected $pluginTitle = 'FAQs'; + protected $pluginTitle = LAN_PLUGIN_FAQS_NAME; protected $pluginName = 'faqs'; protected $eventName = 'faqs'; protected $table = "faqs"; @@ -202,22 +202,22 @@ class faq_main_ui extends e_admin_ui protected $batchCopy = true; protected $listOrder = 'faq_order ASC'; protected $sortField = 'faq_order'; - protected $tabs = array('FAQs',"Details"); // Simpler method than 'fieldsets'. Allows for easy moving of fields between tabs and works as required by 'news' and 'custom pages'. + protected $tabs = array(LANA_FAQ_QUESTION, LAN_DETAILS); // Simpler method than 'fieldsets'. Allows for easy moving of fields between tabs and works as required by 'news' and 'custom pages'. //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_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), + '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_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_tags' => array('title'=> LANA_FAQ_TAGS, 'tab' => 1, 'type' => 'tags', 'data' => 'str', 'width' => 'auto', 'inline'=> true, 'help' => LANA_FAQ_TAGS_HELP), // User id + '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 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_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 + '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 ), '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 @@ -229,35 +229,33 @@ class faq_main_ui extends e_admin_ui protected $fieldpref = array('checkboxes', 'faq_question', 'faq_answer', 'faq_parent', 'faq_datestamp', 'options'); - protected $preftabs = array(LAN_GENERAL, LAN_PLUGIN_FAQS_NAME , LAN_CATEGORIES); + protected $preftabs = array(LAN_GENERAL, LAN_DISPLAY, 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' ), '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' ), + 'submit_question_limit' => array('title'=> LANA_FAQ_PREF_4, 'tab'=>0, 'type'=>'number', 'data'=>'int', 'help'=>LANA_FAQ_PREF_HELP_1), + 'submit_question_char_limit'=> array('title'=> LANA_FAQ_PREF_5, 'tab'=>0, 'type'=>'number', 'data'=>'int', 'help'=>LANA_FAQ_PREF_HELP_1, 'writeParms'=>array('max'=>255, 'default'=>255)), + 'submit_question_language' => array('title'=> LANA_FAQ_PREF_6, 'tab'=>0, 'type'=>'dropdown' ), + 'submit_question_acknowledgement'=> array('title'=> LANA_FAQ_PREF_7, 'tab'=>0, 'type'=>'textarea', 'help'=>LANA_FAQ_PREF_HELP_2), +//new display tab + 'classic_look' => array('title'=> LANA_FAQ_PREF_3, 'tab'=>1, 'type'=>'boolean' ), + 'list_type' => array('title'=> LANA_FAQ_PREF_8, 'tab'=>1, 'type'=>'dropdown', 'writeParms'=>array('ul'=>LANA_FAQ_PREF_9, 'ol'=>LANA_FAQ_PREF_10)), + 'page_title' => array('title'=> LANA_FAQ_PREF_11, 'tab'=>1, 'type'=>'text', 'multilan'=>true, 'help'=>LANA_FAQ_PREF_HELP_2), + 'new' => array('title'=> LANA_FAQ_PREF_12, 'tab'=>1, 'type'=>'number', 'writeParms'=>'size=mini&default=0&post=days old', 'help'=>LANA_FAQ_PREF_HELP_2), + 'display_total' => array('title'=> LANA_FAQ_PREF_13, 'tab'=>1, 'type'=>'boolean', 'data'=>'int' ), + 'display_datestamp' => array('title'=> LANA_FAQ_PREF_14, 'tab'=>1, 'type'=>'boolean', 'data'=>'int' ), + 'display_social' => array('title'=> LANA_FAQ_PREF_15, 'tab'=>1, 'type'=>'boolean', 'data'=>'int' ), + 'orderby' => array('title'=> LAN_ORDER, 'tab'=>1, 'type'=>'dropdown', 'writeParms'=>array('faq_order-ASC'=>LANA_FAQ_PREF_16, 'faq_id-ASC'=>LAN_ID." ".LAN_ASC, 'faq_id-DESC'=>LAN_ID." ".LAN_DESC, 'faq_datestamp-ASC'=>LAN_DATE." ".LAN_ASC, 'faq_datestamp-DESC'=>LAN_DATE."-".LAN_DESC)), - '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' ), + 'admin_faq_create' => array('title'=> LAN_CREATE_ITEM, 'tab'=>2, 'type'=>'userclass', 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ), + 'admin_faq_edit' => array('title'=> LAN_EDIT, 'tab'=>2, 'type'=>'userclass', 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ), + 'admin_faq_delete' => array('title'=> LAN_DELETE, 'tab'=>2, 'type'=>'userclass', 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ), - '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'=> 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'=> 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' ), + 'admin_cat_create' => array('title'=> LAN_CREATE_CATEGORY, 'tab'=>3, 'type'=>'userclass' , 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ), + 'admin_cat_edit' => array('title'=> LAN_EDIT, 'tab'=>3, 'type'=>'userclass' , 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ), + 'admin_cat_delete' => array('title'=> LAN_DELETE, 'tab'=>3, 'type'=>'userclass' , 'writeParms'=>'default=254&classlist=main,admin,classes,no-excludes' ), ); protected $categories = array(); @@ -265,7 +263,7 @@ class faq_main_ui extends e_admin_ui public function init() { - $this->prefs['submit_question_language']['writeParms'] = array(0=> 'English', 1=>'All Languages'); + $this->prefs['submit_question_language']['writeParms'] = array(0=> 'English', 1=>LANA_FAQ_PREF_17);//TODO - Site Language? $sql = e107::getDb(); diff --git a/e107_plugins/faqs/e_cron.php b/e107_plugins/faqs/e_cron.php index 850be3980..ccde968c3 100644 --- a/e107_plugins/faqs/e_cron.php +++ b/e107_plugins/faqs/e_cron.php @@ -15,14 +15,16 @@ { function config() { - + $tp = e107::getParser(); $cron = array(); - + + $siteadminemail = e107::pref('core','siteadminemail'); + $cron[] = array( - 'name' => "Unanswered Questions Report", //TODO LAN + 'name' => LANA_FAQ_CRON_1, 'function' => "unanswered", 'category' => "notify", - 'description' => "Mails a report of unanswered questions to ".e107::pref('core','siteadminemail').'.' // TODO LAN + 'description' => $tp->lanVars(LANA_FAQ_CRON_2, $siteadminemail) ); return $cron; @@ -57,22 +59,24 @@ // $questions = array( "Test Question
".$tp->toDate(time(),'short').""); - $name = SITENAME . " Automation"; + $name = SITENAME." ".LAN_AUTOMATION; $email = e107::pref('core','siteadminemail'); $name = e107::pref('core','siteadmin'); $link = $tp->replaceConstants("{e_PLUGIN}faqs/admin_config.php?mode=main&action=list&filter=pending", 'full'); - $body = "

".count($count)." Unuanswered Questions at ".SITENAME."

To answer these questions, please login to ".SITENAME." and then click here.
- The ".$limit." most recent questions are displayed below. - "; + $body = "

".$tp->lanVars(LANA_FAQ_CRON_3, count($count), SITENAME)."

";// Unanswered Questions at + $body .= LANA_FAQ_CRON_4."
"; //To answer these qus. + $body .= "".LAN_CLICK_HERE."
"; + $body .= $tp->lanVars(LANA_FAQ_CRON_5,$limit);//The limit + $body .= ""; $eml = array( - 'subject' => count($count)." Unuanswered Question as of ".date('d-M-Y')." ", + 'subject' => $tp->lanVars(LANA_FAQ_CRON_6, count($count), ,date('d-M-Y')), // 'sender_email' => $email, - 'sender_name' => SITENAME . " Automation", + 'sender_name' => SITENAME." ".LAN_AUTOMATION, // 'replyto' => $email, 'html' => true, 'template' => 'default', diff --git a/e107_plugins/faqs/faqs_shortcodes.php b/e107_plugins/faqs/faqs_shortcodes.php index 2e4bedca0..064d81fc4 100644 --- a/e107_plugins/faqs/faqs_shortcodes.php +++ b/e107_plugins/faqs/faqs_shortcodes.php @@ -277,7 +277,7 @@ class faqs_shortcodes extends e_shortcode if(!empty($parms['expand']) && $faqpref['submit_question'] != e_UC_NOBODY) { $hide = 'e-hideme'; - $button = "Ask a Question"; + $button = "".LAN_FAQS_ASK_A_QUESTION.""; } else { @@ -297,8 +297,8 @@ class faqs_shortcodes extends e_shortcode { $text .= $frm->open('faq-ask-question','post'); //TODO LAN ie. [x] character limit. - $text .= "
".$frm->textarea('ask_a_question','',3, 80 ,array('maxlength'=>$this->questionCharLimit, 'size'=>'xxlarge','placeholder'=>'Type your question here..', 'wrap'=>'soft'))." -
".$this->questionCharLimit." character limit
".$frm->submit('submit_a_question','Submit')."
"; + $text .= "
".$frm->textarea('ask_a_question','',3, 80 ,array('maxlength'=>$this->questionCharLimit, 'size'=>'xxlarge','placeholder'=>LAN_FAQS_ENTER_A_QUESTION_HERE, 'wrap'=>'soft'))." +
".$this->questionCharLimit." ".LAN_FAQS_CHAR_LIMIT".
".$frm->submit('submit_a_question',LAN_SUBMIT)."
"; $text .= $frm->close(); } @@ -308,13 +308,13 @@ class faqs_shortcodes extends e_shortcode '[' => "", ']' => "" ); - //TODO LAN - $text .= str_replace(array_keys($srp), array_values($srp), "Please [register] and/or login to post a question."); + + $text .= str_replace(array_keys($srp), array_values($srp), LAN_FAQS_PLEASE_REGISTER); } else { - //TODO LAN - $text .= "Not permitted at this time."; + + $text .= LAN_FAQS_NOT_PERMITTED; } $text .= ""; @@ -339,9 +339,9 @@ class faqs_shortcodes extends e_shortcode if(!empty($list)) { - //TODO LAN + $text = "
"; - $text .= "

You have requested answers to the following questions:

"; + $text .= "

".LAN_FAQS_YOUR_REQUESTED_FAQS."

"; $text .= "