How to create a new module that only contains a guide for users?

Discussion in 'Developers' Forum' started by Student13, Nov 22, 2011.

  1. Student13

    Student13 New Member

    HI! :)

    I have added a menu item in "Support" menu in "Help" module.

    //* Add a menu item with the label 'Manual'
    $items[] = array( 'title' => 'Manual',
    'target' => 'content',
    'link' => 'help/support_manual.php');

    ------------------

    (support_manual.php)

    <?php

    //* Include the basic application and configuration files
    require_once('../../lib/config.inc.php');
    require_once('../../lib/app.inc.php');

    //* Check permissions for module
    $app->auth->check_module_permissions('help');

    echo "SHOW GUIDE: <hr><a href='http://www.mkzsoluciones.com/manuales/GUIA_ISPCONFIG.pdf'>http://www.mkzsoluciones.com/manuales/GUIA_ISPCONFIG.pdf</a><hr>";

    ?>

    And all this works perfectly.

    But, now I want to create a new module that only contains this menu item. I have tried the follow steps:

    mkdir manual/
    mkdir manual/form
    mkdir manual/lib
    mkdir manual/lib/lang
    mkdir manual/list
    mkdir manual/templates

    In manual/ folder, I have created this file called "support_manual.php":

    <?php

    //* Include the basic application and configuration files
    require_once('../../lib/config.inc.php');
    require_once('../../lib/app.inc.php');

    //* Check permissions for module
    $app->auth->check_module_permissions('help');

    echo "SHOW GUIDE: <hr><a href='http://www.mkzsoluciones.com/manuales/GUIA_ISPCONFIG.pdf'>http://www.mkzsoluciones.com/manuales/GUIA_ISPCONFIG.pdf</a><hr>";

    ?>

    In /lib folder, I have created this file called "module.conf.php":

    <?php

    //* Name of the module. The Module name must match the name of the module directory. The module name may not contain spaces.
    $module['name'] = 'manual';

    //* Title of the module. The title is dispalyed in the top navigation.
    $module['title'] = 'Manual';

    //* The templates file of the module. This is always module.tpl.htm if you do not have any special requirements like a 3 column layout.
    $module['template'] = 'module.tpl.htm';

    //* The width of the tab. Normally you should leave this empty and let the browser define the width automatically.
    $module['tab_width'] = '';

    //* The page that is displayed when the module is loaded.
    $module['starpage'] = 'manual/support_manual.php';

    //*** Menu Definition ***

    //* Make sure that the items array is empty.
    $items = array();

    //* Add a menu item with the label 'Manual ISPConfig'.
    $items[] = array('title' => 'Manual ISPConfig',
    'target' => 'content',
    'link' => 'manual/support_manual.php');

    //* Add the menu items defined above
    $module['nav'][] = array('title' => 'Manuales',
    'open' => 1,
    'items' => $items);
    ?>

    And, also I have created this file called "admin.conf.php":

    <?php

    /*
    The admin.conf.php file contains menu definitions to be displayed in the administration module.
    */
    ?>

    All this creates a new module called "Manual" and inside this module is created a menu called "Manual ISPConfig".

    The PROBLEM:

    This module doesn't show the link that redirects to the guide for users.

    Why doesn't it show?
    How can I solve this problem?


    THANKS! ;)
    ------------------------

    This is my first post in English language, so there may be several mistakes. :eek:
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The modules of a user are configured in the user settings. Go to System > CP users and enable your new module for the user that shall see this module. Then logout and login again if you modified the user that is currently logged in.
     
  3. Student13

    Student13 New Member

    Hi till! :)

    Thank you very much for your reply. But, that just do it. The problem is that inside the module called "Manual" isn't showed the link that redirects to guide for users.

    The "Manual" module would be:

    Manual | SHOW GUIDE:
    ----------------- |
    Manual ISPConfig | http://www.mkzsoluciones.com/manuales/GUIA_ISPCONFIG.pdf
    |
    |
    But, the part of "SHOW GUIDE" and the url isn't showed.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Have you created the language file(s) for the manual titles in manual/lib/lang/ ?
     
  5. Student13

    Student13 New Member

    Yes. Simply, I have created this:

    In lib/lang/

    (es.lang)

    <?php
    $wb['Manual'] = 'Manual';
    $wb['Manuales ISPConfig'] = 'Manuales ISPConfig';
    ?>

    (es_support_manual.lng)

    <?php
    $wb['Manual'] = 'Manual';
    $wb['Manuales ISPConfig'] = 'Manuales ISPConfig';
    ?>

    I don't know if it's necessary to add more files in others languages. I only need it in Spanish language, for this I've not added more files.
     
  6. Student13

    Student13 New Member

    HI! :)

    Here, I've let an attachment that contain two images of my ISPConfig interface.

    In the IMAGE1, there is a menu item ("Manual") that shows a url that redirect to the guide for users (pdf document).

    In the IMAGE2, there is a new module that shows new menu with two labels ("Manual" and "Manual ISPConfig"). These labels should show the url that redirect to the guide for users (pdf document). But, they don't show it. :(

    PLEASE, I NEED A SOLUTION! :)

    THANK YOU! :D
     

    Attached Files:

  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Change the line:

    $app->auth->check_module_permissions('help');

    to:

    $app->auth->check_module_permissions('manual');

    in the support_manual.php file.
     
  8. Student13

    Student13 New Member

    Thank you Till! :)

    Just do it! But, the URL doesn't appear.

    I suppose that you've seen the attachment, so you'll have seen the two images.

    And, the question is: why does the masthead of ISPConfig appear instead of the URL that redirect to the guide for users (pdf document) ?!?! :confused: (in IMAGE2 of attachmet, you can see this).
     
    Last edited: Nov 23, 2011
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    This happens when you load a file where the user has no permission to view it.
     
  10. Student13

    Student13 New Member

    First, thank you very much for your time! :)

    But, I login as "administrator" and I have all permissions activated. So, I've access to all modules, including the module that I've created ("Manual").
    I know this because I edited the user "administrator" in System -> CP Users -> Edit users. In fact, you can check this in IMAGE1 and IMAGE2, because in both images appear all modules activated in top menu, including the module that I've created ("Manual").
     
  11. Student13

    Student13 New Member

    Perhaps, I've to add some files that contain some templates... :rolleyes:

    Or that is not necessary??

    PLEASE, HELP ME!!! :)
     
    Last edited: Nov 23, 2011

Share This Page