Commit 04e09afc authored by filip's avatar filip
Browse files

Implemented new FAQ functionality in help module

parent fb33392c
-- --------------------------------------------------------
-- tables for the FAQ module
CREATE TABLE `help_faq_sections` (
`hfs_id` int(11) NOT NULL AUTO_INCREMENT,
`hfs_name` varchar(255) DEFAULT NULL,
`hfs_order` int(11) DEFAULT '0',
`sys_userid` int(11) DEFAULT NULL,
`sys_groupid` int(11) DEFAULT NULL,
`sys_perm_user` varchar(5) DEFAULT NULL,
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
PRIMARY KEY (`hfs_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
INSERT INTO `help_faq_sections` VALUES (1,'General',0,NULL,NULL,NULL,NULL,NULL);
CREATE TABLE `help_faq` (
`hf_id` int(11) NOT NULL AUTO_INCREMENT,
`hf_section` int(11) DEFAULT NULL,
`hf_order` int(11) DEFAULT '0',
`hf_question` text,
`hf_answer` text,
`sys_userid` int(11) DEFAULT NULL,
`sys_groupid` int(11) DEFAULT NULL,
`sys_perm_user` varchar(5) DEFAULT NULL,
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
PRIMARY KEY (`hf_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
INSERT INTO `help_faq` VALUES (1,1,0,'I\'d like to know ...','Yes, of course.',1,1,'riud','riud','r');
......@@ -1617,6 +1617,38 @@ INSERT INTO `country` (`iso`, `name`, `printable_name`, `iso3`, `numcode`) VALUE
('ZW', 'ZIMBABWE', 'Zimbabwe', 'ZWE', 716);
-- --------------------------------------------------------
-- tables for the FAQ module
CREATE TABLE `help_faq_sections` (
`hfs_id` int(11) NOT NULL AUTO_INCREMENT,
`hfs_name` varchar(255) DEFAULT NULL,
`hfs_order` int(11) DEFAULT '0',
`sys_userid` int(11) DEFAULT NULL,
`sys_groupid` int(11) DEFAULT NULL,
`sys_perm_user` varchar(5) DEFAULT NULL,
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
PRIMARY KEY (`hfs_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
INSERT INTO `help_faq_sections` VALUES (1,'General',0,NULL,NULL,NULL,NULL,NULL);
CREATE TABLE `help_faq` (
`hf_id` int(11) NOT NULL AUTO_INCREMENT,
`hf_section` int(11) DEFAULT NULL,
`hf_order` int(11) DEFAULT '0',
`hf_question` text,
`hf_answer` text,
`sys_userid` int(11) DEFAULT NULL,
`sys_groupid` int(11) DEFAULT NULL,
`sys_perm_user` varchar(5) DEFAULT NULL,
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
PRIMARY KEY (`hf_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1;
INSERT INTO `help_faq` VALUES (1,1,0,'I\'d like to know ...','Yes, of course.',1,1,'riud','riud','r');
-- --------------------------------------------------------
SET FOREIGN_KEY_CHECKS = 1;
<?php
// From and List definition files
$list_def_file = 'list/faq_list.php';
$tform_def_file = 'form/faq.tform.php';
// Include the base libraries
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
// Check module permissions
if(!stristr($_SESSION['s']['user']['modules'],'help')) {
header('Location: ../index.php');
die;
}
// Load the form
$app->uses('tform_actions');
$app->tform_actions->onDelete();
?>
<?php
// Set the path to the form definition file.
$tform_def_file = 'form/faq.tform.php';
// include the core configuration and application classes
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
// Check the module permissions and redirect if not allowed.
if(!stristr($_SESSION['s']['user']['modules'],'help')) {
header('Location: ../index.php');
die;
}
// Load the templating and form classes
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
// Create a class page_action that extends the tform_actions base class
class page_action extends tform_actions {
//* Customisations for the page actions will be defined here
}
// Create the new page object
$page = new page_action();
// Start the page rendering and action handling
$page->onLoad();
?>
<?php
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
// Path to the list definition file
$list_def_file = 'list/faq_list.php';
// Check the module permissions
if(!stristr($_SESSION['s']['user']['modules'],'help')) {
header('Location: ../index.php');
die();
}
// Loading the class
$app->uses('listform_actions');
// Optional limit
$hf_section = 0;
if(isset($_GET['hfs_id']))
$hf_section = preg_replace("/[^0-9]/","",$_GET['hfs_id']);
// if section id is not specified in the url, choose the first existing section
if(!$hf_section)
{
$res = $app->db->queryOneRecord("SELECT MIN(hfs_id) AS min_id FROM help_faq_sections");
$hf_section = $res['min_id'];
}
$app->listform_actions->SQLExtWhere = "hf_section = $hf_section";
$res = $app->db->queryOneRecord("SELECT hfs_name FROM help_faq_sections WHERE hfs_id=$hf_section");
// Start the form rendering and action ahndling
echo "<h2>FAQ: ".$res['hfs_name']."</h2>";
$app->listform_actions->onLoad();
?>
<?php
// From and List definition files
$list_def_file = 'list/faq_sections_list.php';
$tform_def_file = 'form/faq_sections.tform.php';
// Include the base libraries
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
// Check module permissions
if(!stristr($_SESSION['s']['user']['modules'],'help')) {
header('Location: ../index.php');
die;
}
// Load the form
$app->uses('tform_actions');
$app->tform_actions->onDelete();
?>
<?php
// Set the path to the form definition file.
$tform_def_file = 'form/faq_sections.tform.php';
// include the core configuration and application classes
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
// Check the module permissions and redirect if not allowed.
if(!stristr($_SESSION['s']['user']['modules'],'help')) {
header('Location: ../index.php');
die;
}
// Load the templating and form classes
$app->uses('tpl,tform,tform_actions');
$app->load('tform_actions');
// Create a class page_action that extends the tform_actions base class
class page_action extends tform_actions {
//* Customisations for the page actions will be defined here
}
// Create the new page object
$page = new page_action();
// Start the page rendering and action handling
$page->onLoad();
?>
<?php
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
// Path to the list definition file
$list_def_file = 'list/faq_sections_list.php';
// Check the module permissions
if(!stristr($_SESSION['s']['user']['modules'],'help')) {
header('Location: ../index.php');
die();
}
// Loading the class
$app->uses('listform_actions');
// Start the form rendering and action ahndling
$app->listform_actions->onLoad();
?>
<?php
// Title of the form.
$form['title'] = 'Frequently Asked Questions';
// Optional description of the form.
$form['description'] = '';
// Name of the form which cannot contain spaces or foreign characters.
$form['name'] = 'faq_form';
// The file that is used to call the form in the browser.
$form['action'] = 'faq_edit.php';
// The name of the database table used to store the data
$form['db_table'] = 'help_faq';
// The name of the database table index field.
// This field must be a numeric auto increment column.
$form['db_table_idx'] = 'hf_id';
// Should changes to this table be stored in the database history (sys_datalog) table.
// This should be set to 'yes' for all tables that store configuration information.
$form['db_history'] = 'no';
// The name of the tab that is shown when the form is opened
$form['tab_default'] = 'message';
// The name of the default list file of this form
$form['list_default'] = 'faq_list.php';
// Use the internal authentication system for this table. This should
// be set to 'yes' in most cases, otherwise 'no'.
$form['auth'] = 'yes';
//** Authentication presets. The defaults below does not need to be changed in most cases.
// 0 = id of the user, > 0 id must match with id of current user
$form['auth_preset']['userid'] = 0;
// 0 = default groupid of the user, > 0 id must match with groupid of current
$form['auth_preset']['groupid'] = 0;
// Permissions with the following codes: r = read, i = insert, u = update, d = delete
$form['auth_preset']['perm_user'] = 'riud';
$form['auth_preset']['perm_group'] = 'riud';
$form['auth_preset']['perm_other'] = 'r';
// The form definition of the first tab. The name of the tab is called 'message'. We refer
// to this name in the $form['tab_default'] setting above.
$form['tabs']['message'] = array(
'title' => 'FAQ', // Title of the Tab
'width' => 100, // Tab width
'template' => 'templates/faq_edit.htm', // Template file name
'fields' => array(
//*** BEGIN Datatable columns **********************************
'hf_section' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '',
'datasource' => array ( 'type' => 'SQL',
'querystring' => 'SELECT hfs_id,hfs_name FROM help_faq_sections',
'keyfield' => 'hfs_id',
'valuefield' => 'hfs_name'
),
'validators' => array ( 0 => array ( 'type' => 'ISINT',
'errmsg'=> 'recipient_id_is_not_integer'),
),
'value' => ($_SESSION['s']['user']['typ'] != 'admin')?array(1 => 'Administrator'):''
),
'hf_question' => array(
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array( 0 => array( 'type' => 'NOTEMPTY',
'errmsg'=> 'subject_is_empty'
),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
'hf_answer' => array(
'datatype' => 'TEXT',
'formtype' => 'TEXTAREA',
'validators' => array( 0 => array( 'type' => 'NOTEMPTY',
'errmsg'=> 'message_is_empty'
),
),
'default' => '',
'value' => '',
'cols' => '30',
'rows' => '10',
'maxlength' => '255'
),
//*** END Datatable columns **********************************
)
);
?>
<?php
// Title of the form.
$form['title'] = 'FAQ Sections';
// Optional description of the form.
$form['description'] = '';
// Name of the form which cannot contain spaces or foreign characters.
$form['name'] = 'faq_sections_form';
// The file that is used to call the form in the browser.
$form['action'] = 'faq_sections_edit.php';
// The name of the database table used to store the data
$form['db_table'] = 'help_faq_sections';
// The name of the database table index field.
// This field must be a numeric auto increment column.
$form['db_table_idx'] = 'hfs_id';
// Should changes to this table be stored in the database history (sys_datalog) table.
// This should be set to 'yes' for all tables that store configuration information.
$form['db_history'] = 'no';
// The name of the tab that is shown when the form is opened
$form['tab_default'] = 'message';
// The name of the default list file of this form
$form['list_default'] = 'faq_sections_list.php';
// Use the internal authentication system for this table. This should
// be set to 'yes' in most cases, otherwise 'no'.
$form['auth'] = 'yes';
//** Authentication presets. The defaults below does not need to be changed in most cases.
// 0 = id of the user, > 0 id must match with id of current user
$form['auth_preset']['userid'] = 0;
// 0 = default groupid of the user, > 0 id must match with groupid of current
$form['auth_preset']['groupid'] = 0;
// Permissions with the following codes: r = read, i = insert, u = update, d = delete
$form['auth_preset']['perm_user'] = 'riud';
$form['auth_preset']['perm_group'] = 'riud';
$form['auth_preset']['perm_other'] = '';
// The form definition of the first tab. The name of the tab is called 'message'. We refer
// to this name in the $form['tab_default'] setting above.
$form['tabs']['message'] = array(
'title' => 'FAQ', // Title of the Tab
'width' => 100, // Tab width
'template' => 'templates/faq_sections_edit.htm', // Template file name
'fields' => array(
//*** BEGIN Datatable columns **********************************
'hfs_name' => array(
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array( 0 => array( 'type' => 'NOTEMPTY',
'errmsg'=> 'subject_is_empty'
),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255'
),
//*** END Datatable columns **********************************
)
);
?>
......@@ -6,4 +6,8 @@ $wb['View messages'] = 'Zobrazit zprávu';
$wb['Support'] = 'Podpora';
$wb['About ISPConfig'] = 'O ISPConfigu';
$wb['Version'] = 'Verze';
$wb['Frequently Asked Questions'] = 'Často kladené dotazy';
$wb['FAQ Sections'] = 'Sekce FAQ';
$wb['Manage Sections'] = 'Spravovat sekce';
$wb['Add a Question & Answer Pair'] = 'Přidat otázku a odpověď';
?>
<?php
$wb['faq_faq_txt'] = "Často kladené dotazy";
$wb['faq_question_txt'] = "Otázka";
$wb['faq_answer_txt'] = "Odpověď";
$wb['faq_section_txt'] = "Sekce";
?>
<?php
$wb['faq_section_name_txt'] = "Název sekce";
?>
<?php
$wb['faq_section_name_txt'] = "Název sekce";
$wb['faq_delete_txt'] = "Smazat";
$wb['faq_edit_txt'] = "Upravit";
$wb['faq_sections_txt'] = "Sekce";
$wb['faq_faq_sections_txt'] = "Sekce FAQ";
$wb['faq_new_section_txt'] = "Přidat novou sekci";
?>
......@@ -6,5 +6,10 @@ $wb['View messages'] = 'View messages';
$wb['Support'] = 'Support';
$wb['About ISPConfig'] = 'About ISPConfig';
$wb['Version'] = 'Version';
$wb['Frequently Asked Questions'] = 'Frequently Asked Questions';
$wb['FAQ Sections'] = 'FAQ Sections';
$wb['Manage Sections'] = 'Manage Sections';
$wb['Add a Question & Answer Pair'] = 'Add a Question & Answer Pair';
?>
<?php
$wb['faq_faq_txt'] = "Frequently Asked Questions";
$wb['faq_question_txt'] = "Question";
$wb['faq_answer_txt'] = "Answer";
$wb['faq_section_txt'] = "Section";
?>
<?php
$wb['faq_section_name_txt'] = "Section Name";
?>
<?php
$wb['faq_section_name_txt'] = "Section Name";
$wb['faq_delete_txt'] = "Delete";
$wb['faq_edit_txt'] = "Edit";
$wb['faq_sections_txt'] = "Sections";
$wb['faq_faq_sections_txt'] = "FAQ Sections";
$wb['faq_new_section_txt'] = "Add a new section";
?>
......@@ -10,7 +10,10 @@ $module['title'] = 'top_menu_help';
$module['template'] = 'module.tpl.htm';
//* The page that is displayed when the module is loaded. the path must is relative to the web directory
$module['startpage'] = 'help/index.php';
if(isset($_GET['go2_faq_sections_list']))
$module['startpage'] = 'help/faq_sections_list.php';
else
$module['startpage'] = 'help/index.php';
//* The width of the tab. Normally you should leave this empty and let the browser define the width automatically.
$module['tab_width'] = '';
......@@ -39,6 +42,33 @@ $module['nav'][] = array( 'title' => 'Support',
'open' => 1,
'items' => $items);
//* the FAQ menu section
$itemsfaq = array();
//* admin's tools
if($_SESSION['s']['user']['typ'] == 'admin') {
$itemsfaq[] = array( 'title' => 'Add a Question & Answer Pair',
'target' => 'content',
'link' => 'help/faq_edit.php');
$itemsfaq[] = array( 'title' => 'Manage Sections',
'target' => 'content',
'link' => 'help/faq_sections_list.php');
}
$sql = "SELECT * FROM help_faq_sections";
$res = $app->db->queryAllRecords($sql);
//* all the content sections
foreach($res as $v)
{
$itemsfaq[] = array( 'title' => $v['hfs_name'],
'target' => 'content',
'link' => 'help/faq_list.php?hfs_id='.$v['hfs_id']);
}
$module['nav'][] = array( 'title' => 'FAQ',
'open' => 1,
'items' => $itemsfaq);
//* -- end of the FAQ menu section
if($_SESSION['s']['user']['typ'] == 'admin') {
//* make sure that the items array is empty
......@@ -60,4 +90,4 @@ $module['nav'][] = array( 'title' => 'About ISPConfig',
?>
\ No newline at end of file
?>
<?php
// Name of the list
$liste['name'] = 'help_faq';
// Database table
$liste['table'] = 'help_faq';
// Index index field of the database table
$liste['table_idx'] = 'hf_id';
// Search Field Prefix
#$liste['search_prefix'] = 'search_';
// Records per page
$liste['records_per_page']= 100;
// Script File of the list
$liste['file'] = 'faq_list.php';
// Script file of the edit form
$liste['edit_file'] = 'faq_edit.php';
// Script File of the delete script
$liste['delete_file'] = 'faq_delete.php';
// Paging Template
$liste['paging_tpl'] = 'templates/paging.tpl.htm';
// Enable auth
$liste['auth'] = 'yes';
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment