filip
2010-10-04 1b9dcca62389ec5e62d0d8825da5873eafb59762
Added manage questions functionality to FAQ for admin.

6 files modified
5 files added
162 ■■■■■ changed files
interface/web/help/faq_delete.php 2 ●●● patch | view | raw | blame | history
interface/web/help/faq_manage_questions_list.php 20 ●●●●● patch | view | raw | blame | history
interface/web/help/form/faq.tform.php 2 ●●● patch | view | raw | blame | history
interface/web/help/lib/lang/cz.lng 1 ●●●● patch | view | raw | blame | history
interface/web/help/lib/lang/cz_faq_manage_questions_list.lng 10 ●●●●● patch | view | raw | blame | history
interface/web/help/lib/lang/en.lng 2 ●●● patch | view | raw | blame | history
interface/web/help/lib/lang/en_faq_manage_questions_list.lng 10 ●●●●● patch | view | raw | blame | history
interface/web/help/lib/module.conf.php 23 ●●●●● patch | view | raw | blame | history
interface/web/help/list/faq_list.php 2 ●●● patch | view | raw | blame | history
interface/web/help/list/faq_manage_questions_list.php 47 ●●●●● patch | view | raw | blame | history
interface/web/help/templates/faq_manage_questions_list.htm 43 ●●●●● patch | view | raw | blame | history
interface/web/help/faq_delete.php
@@ -1,7 +1,7 @@
<?php
// From and List definition files
$list_def_file = 'list/faq_list.php';
$list_def_file = 'list/faq_manage_questions_list.php';
$tform_def_file = 'form/faq.tform.php';
// Include the base libraries
interface/web/help/faq_manage_questions_list.php
New file
@@ -0,0 +1,20 @@
<?php
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//* Path to the list definition file
$list_def_file = "list/faq_manage_questions_list.php";
//* Check permissions for module
$app->auth->check_module_permissions('help');
//* Loading the class
$app->uses('listform_actions');
//* Optional limit
#$app->listform_actions->SQLExtWhere = "recipient_id = ".$_SESSION['s']['user']['userid'];
//* Start the form rendering and action ahndling
$app->listform_actions->onLoad();
?>
interface/web/help/form/faq.tform.php
@@ -27,7 +27,7 @@
$form['tab_default']    = 'message';
// The name of the default list file of this form
$form['list_default']    = 'faq_list.php';
$form['list_default']    = 'faq_manage_questions_list.php';
// Use the internal authentication system for this table. This should
// be set to 'yes' in most cases, otherwise 'no'.
interface/web/help/lib/lang/cz.lng
@@ -9,5 +9,6 @@
$wb['Frequently Asked Questions'] = 'Často kladené dotazy';
$wb['FAQ Sections'] = 'Sekce FAQ';
$wb['Manage Sections'] = 'Spravovat sekce';
$wb['Manage Questions'] = 'Spravovat dotazy';
$wb['Add a Question & Answer Pair'] = 'Přidat otázku a odpověď';
?>
interface/web/help/lib/lang/cz_faq_manage_questions_list.lng
New file
@@ -0,0 +1,10 @@
<?php
$wb['faq_question_txt'] = "Otázka";
$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_questions_txt'] = "Často kladené dotazy";
$wb['faq_new_question_txt'] = "Přidat nový dotaz";
?>
interface/web/help/lib/lang/en.lng
@@ -10,6 +10,6 @@
$wb['FAQ Sections'] = 'FAQ Sections';
$wb['Manage Sections'] = 'Manage Sections';
$wb['Add a Question & Answer Pair'] = 'Add a Question & Answer Pair';
$wb['Manage Questions'] = 'Manage Questions';
?>
interface/web/help/lib/lang/en_faq_manage_questions_list.lng
New file
@@ -0,0 +1,10 @@
<?php
$wb['faq_question_txt'] = "Question";
$wb['faq_section_name_txt'] = "Section";
$wb['faq_delete_txt'] = "Delete";
$wb['faq_edit_txt'] = "Edit";
$wb['faq_sections_txt'] = "Section";
$wb['faq_faq_questions_txt'] = "Frequently Asked Questions";
$wb['faq_new_question_txt'] = "Add a new question & answer pair";
?>
interface/web/help/lib/module.conf.php
@@ -46,21 +46,24 @@
$itemsfaq = array();
//* admin's tools
if($_SESSION['s']['user']['typ'] == 'admin') {
    $itemsfaq[] = array(     'title'        => 'Add a Question & Answer Pair',
    $itemsfaq[] = array(     'title'        => 'Manage Questions',
                            'target'    => 'content',
                            'link'        => 'help/faq_edit.php');
                            'link'        => 'help/faq_manage_questions_list.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
if(is_array($res)) {
    foreach($res as $v) {
        $itemsfaq[] = array(     'title'        => $v['hfs_name'],
                                'target'    => 'content',
                                'link'        => 'help/faq_list.php?hfs_id='.$v['hfs_id']);
else
{ //* the user
    $sql = "SELECT * FROM help_faq_sections";
    $res = $app->db->queryAllRecords($sql);
    //* all the content sections
    if(is_array($res)) {
        foreach($res as $v) {
            $itemsfaq[] = array(     'title'        => $v['hfs_name'],
                                    'target'    => 'content',
                                    'link'        => 'help/faq_list.php?hfs_id='.$v['hfs_id']);
        }
    }
}
interface/web/help/list/faq_list.php
@@ -16,7 +16,7 @@
$liste['records_per_page']= 100;
// Script File of the list
$liste['file'] = 'faq_list.php';
$liste['file'] = 'faq_manage_questions_list.php';
// Script file of the edit form
$liste['edit_file'] = 'faq_edit.php';
interface/web/help/list/faq_manage_questions_list.php
New file
@@ -0,0 +1,47 @@
<?php
// Name of the list
$liste['name'] = 'faq_manage_questions';
// 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']= 30;
// Script File of the list
$liste['file'] = 'faq_manage_questions_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';
$liste["item"][] = array(   'field'     => "hf_section",
                            'datatype'  => "VARCHAR",
                            'formtype'  => "SELECT",
                            'op'        => "=",
                            'prefix'    => "",
                            'suffix'    => "",
                            'datasource'    => array (  'type'  => 'SQL',
                                                        'querystring' => 'SELECT a.hf_section, b.hfs_name FROM help_faq a, help_faq_sections b WHERE (a.hf_section = b.hfs_id)',
                                                        'keyfield'=> 'hf_section',
                                                        'valuefield'=> 'hfs_name'
                                                      ),
                            'width'     => "",
                            'value'     => "");
?>
interface/web/help/templates/faq_manage_questions_list.htm
New file
@@ -0,0 +1,43 @@
<h2>{tmpl_var name="faq_faq_questions_txt"}</h2>
  <div class="pnl_toolsarea">
    <fieldset><legend>{tmpl_var name="toolsarea_head_txt"}</legend>
      <div class="buttons">
<button class="iconstxt icoAdd" type="button" onclick="loadContent('help/faq_edit.php');">
          <span>{tmpl_var name="faq_new_question_txt"}</span>
        </button>
      </div>
    </fieldset>
  </div>
<div class="pnl_listarea">
<fieldset><legend><tmpl_var name="faq_sections_txt"></legend>
<table class="list">
    <thead>
          <tr>
            <th class="tbl_col_active" scope="col">{tmpl_var name="faq_question_txt"}</th>
            <th class="tbl_col_active" scope="col">{tmpl_var name="faq_section_name_txt"}</th>
            <th class="tbl_col_server_id" scope="col">{tmpl_var name="faq_delete_txt"}</th>
            <th class="tbl_col_domain" scope="col">{tmpl_var name="faq_edit_txt"}</th>
          </tr>
    </thead>
<tmpl_loop name="records">
<tr>
    <td>{tmpl_var name='hf_question'}</td>
    <td>{tmpl_var name='hf_section'}</td>
    <td>
        <div class="buttons icons16">
            <a class="icons16 icoDelete" href="javascript: del_record('help/faq_delete.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');">
            <span>{tmpl_var name="faq_delete_txt"}</span></a> </div>
    </td>
    <td>
         <a href="#" onClick="loadContent('help/faq_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="faq_edit_txt"}</a>
    </td>
</tr>
</tmpl_loop>
</table>
</fieldset>
</div>