Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 09:34:10 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155554 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Adding something to the admin menu..  (Read 1563 times)
Fratm

Offline Offline

Posts: 101



« on: August 29, 2006, 10:09:06 PM »

Is there an easy way to add something to the admin menu?  You know the the menu that has    Start, Pages, Media, Add-ons,  Preferences, etc.....

I figured out how to do it by editing the code code, but I would like to be able to add to this menu from a module.

-Fratm
Logged
N1l3Z

Offline Offline

Posts: 21



« Reply #1 on: April 26, 2007, 05:23:38 PM »

Wow, I want to add something to that menu as well, since I have a module that should be shown there.

Can you enlighten me on where to add it? Wich files did you edit?

Thanx!

NileZ
Logged
Fratm

Offline Offline

Posts: 101



« Reply #2 on: April 26, 2007, 08:37:36 PM »

Wow, I want to add something to that menu as well, since I have a module that should be shown there.

Can you enlighten me on where to add it? Wich files did you edit?

Thanx!

NileZ

It was a real pain in the butt to do.  And I did it so long ago, that I can't quite remember how I did it.. But.... Here are some clues that I dug up from some old notes.

The file you want to edit is in framework/class.admin.php, and you can look around line 117 for examples of other menu items.

Then it seems to me, you had to add entries in the database so that the option would actually show up, but I can't find my notes on how I did it.

Good luck with it.

-Steve
Logged
dccsp92

Offline Offline

Posts: 1


« Reply #3 on: February 15, 2010, 04:47:28 AM »

Here is a quick overview of what I did to 2.81 to get it to work:

My example menu item is named authorization so you would replace that with your menu item name
Also please note that all lines numbers ARE JUST GENERAL LOCATORS AND NOT EXACT PLACEMENT LOCATIONS!

Edit framework/class.admin.php

At around line 145 add your menu item like the following:

array(ADMIN_URL.'/authorization/index.php', '', $MENU['AUTHORIZATION'], 'authorization', 1),



Edit admin/start/index.php

At around line 65 add your menu item like the following:

if($admin->get_permission('authorization') != true) {
    $template->set_var('DISPLAY_AUTHORIZATI ON', 'none');
}

At around line 115 add your menu item like the following:

'AUTHORIZATION' => $MENU['AUTHORIZATION'],

AND

'AUTHORIZATION_OVERV IEW' => $OVERVIEW['AUTHORIZATION'] 


Create your menu directory under the admin folder.  Suggest copying another menu folder over and rename it.

Make sure the folder name matches the name in the first step.  It must have an index.php file as well.


Create your html template file under the templates directory for the template you are using so if
you are using the wb_theme backend template then you would make your template file under

templates/wb_theme/templates

and name it as authorization.htt

The name must be the same as you specify in the index.php file you created under the admin/authorization directory


In order for the new menu item to show up you must add it to the system_permissions value for the Administrator
user in the "groups" table in the database.  I used phpMyAdmin but to do this but there are many other ways like
writing a simple php query and update page.  That is out of the scope of this quick doc.


IF you want your new menu item to show up on the main start page, you have to edit the start.htt file under your backend theme
templates directory.  In our example case it is under templates/wb_theme/templates/ .

You may have to edit things significantly if you add more than one menu item so be aware of this before making this decision.  In
this case we would add the following towrards

        <table cellpadding="0" cellspacing="0" border="0" class="section" style="{DISPLAY_AUTHORIZATION}">
        <tr>
            <td class="graphic" align="center" valign="middle" rowspan="2">
                <a href="{ADMIN_URL}/authorization/index.php">
                    <img src="{THEME_URL}/icons/authorization.png" alt="{AUTHORIZATION}" />
                </a>
            </td>
            <td class="title">
                <a href="{ADMIN_URL}/authorization/index.php">{AUTHORIZATION}</a>
            </td>
        </tr>
        <tr>
            <td class="description">
                {AUTHORIZATION_OVERVIEW}
            </td>
        </tr>
        </table>

You will have to create the authorization.png file or whatever icon file you want to use and put it into the icons directory
under your backend theme directory



In order to add the new menu item to the Groups permissions you must edit the following:

Edit the admin/groups/get_permissions.php file at around line 145 add the follwoing:

        // Authorization
        $system_permissions['authorization_setti ngs'] = $admin->get_post('authorization_setti ngs');
        if($system_permissions['authorization_setti ngs'] == 1) {
            $system_permissions['authorization'] = 1;
        } else {
            $system_permissions['authorization'] = '';
        }

At around line 80 add

    $system_permissions['authorization'] = $admin->get_post('authorization');
    $system_permissions['authorization_setti ngs'] = $system_permissions['auhtorization'];

Next you have to edit the file groups_form.htt under your themes templates directory.  In this case it is
templates/wb_theme/templates/groups_form.htt

Replace <td>&nbsp;</td>  near line 60 with


        <td>
                <input type="checkbox" name="authorization" id="authorization" value="1" {authorization_checked} />
                <label for="authorization">{SECTION_AUTHORIZATION}</label>
            </td>

At around line 240 add something like the following for advanced settings

<tr>
    <td colspan="4">
        <h3>{SECTION_AUTHORIZATION}</h3>
    </td>
</tr>
<tr>
    <td><input name="authorization_setti ngs" id="authorization_setti ngs" type="checkbox" value="1" {authorization_settings_checked} /></td>
    <td><label for="authorization_setti ngs">{TEXT_AUTHORIZE_USERS}</label></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
</tr>

You must add the text replacement tags to the admin/groups/index.php file

around line 170 add something like

'SECTION_AUTHORIZATI ON' => $MENU['AUTHORIZATION'],

and around 180 add something like

'TEXT_AUTHORIZE_USER S' => $TEXT['AUTHORIZE_USERS'],

You must add the text replacement tags to the admin/groups/groups.php file


around line 145 add something like

'SECTION_AUTHORIZATI ON' => $MENU['AUTHORIZATION'],

around line 153 add something like

'TEXT_AUTHORIZE_USER S' => $TEXT['AUTHORIZE_USERS'], 


Add the cooresponding tags to the MAIN languages/ folder files like EN.php  add



$TEXT['AUTHORIZE_USERS'] = 'Authorize Users';


This should get the menu item to show up correctly from my expeirience.  Next you will
actually have to finish the development of your menu item functionality.









Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!