This module provides a way for admins to differentiate environments by assigning colors to the administration menu. It has a dependency on masquerade and admin_menu module to embed a form in the menu so the admin can easily switch between users whilest always keeping the environmental administration menu. This way there is no more wasting time logging in and out when testing multiple roles and you always have an idea of what environment you are on.

Sandbox page:
https://drupal.org/sandbox/Mywebmaster/1871384
Git clone command:
git clone http://git.drupal.org/sandbox/Mywebmaster/1871384.git environmental_administration_menu

The version is only 7.x

I wish to make this project full fledged to make my first return to the community and get some help cleaning up some of my code since I'm pretty much self thaught. I think a lot of people might be interested in this module so getting this out of sandbox would give me a big boost in getting the module of the ground.

I'm still in the midst of adding new features (icon upload, live paint, etc...) so it's definately still a development version. But it is pretty stable since we're using it in our production workflow environments.

During development and theming I've focused on the development version of admin_menu and using the toolbar look. So if you want to test the module I suggest you take the dev version and enable the toolbar look. :)

Comments

alexverb’s picture

Status: Active » Needs review

Needs review.

mikespence’s picture

Status: Needs review » Needs work

Hi Alex,

It's great that you want to start contributing back! This is a great idea for a module, can see that being useful for myself and others.

A helpful thing to do is to run your code through a Drupal code checker. Your result is here:
http://ventral.org/pareview/httpgitdrupalorgsandboxmywebmaster1871384git

This will help you to tie up all the little bits a pieces that are required by the Drupal coding standards.

It's also a good idea to post the link for people to download your module in the description at the top of this page. Yours is:
git clone http://git.drupal.org/sandbox/Mywebmaster/1871384.git environmental_administration_menu

Hope that helps get the ball rolling!

Mike

alexverb’s picture

Status: Needs work » Needs review

I put the clone command up in the description and fixed all pareview code style errors.
http://ventral.org/node/183240/revisions/view/253621/254537

klausi’s picture

We are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and put yourself on the PAReview: review bonus high priority list. Then I'll take a look at your project right away :-)

vlad.pavlovic’s picture

Automatic review: passed (as stated above).
Manual Review:
There is a warning generated by admin_menu_environmental_admin_menu_output_alter when module first enabled.
Warning: Invalid argument supplied for foreach() in admin_menu_environmental_admin_menu_output_alter().

The configuration form is not able to find the 'admin_menu_environmental_colors_form' theme key.

Since you constantly do:

// Get the user current or masquerading.
global $user;
$account = $user;
if (isset($_SESSION['masquerading'])) {
  $account = user_load($_SESSION['masquerading']);
}

You might want to wrap that in a function and call the function returning the appropriate account.

UI/UX Consideration:
In the configuration form, it's unclear that Name and Domain are required fields. Especially evident when creating the first Environment.

Anks’s picture

Status: Needs review » Needs work

Hi Alex,

@admin_menu_environmental.admin.inc

[1] You should use check_plain to ensure your $variable is fully sanitized.

For example - '#title' => $field_title,

[2] In some of files you have missed @file block .

Regards,
Ankit Hinglajia

chris.smith’s picture

  • When there are no icons to display on the 'Icons' menu in the Administration Menu configuration display something such as 'No icons uploaded'
  • Administration configure error 'Notice: Undefined index: name in admin_menu_theme_settings() (line 708 of /var/www/modules/admin_menu/admin_menu.inc).'
alexverb’s picture

Status: Needs work » Needs review

@vlad.pavlovic

  1. I fixed the warning on the foreach() by checking if the environment variable is not empty.
  2. I was just thinking about using a theming function for the coloring form, not actually using it. So that has been deleted.
  3. I've wrapped the 3 occurrences of the same code into one function for re-use.
    /**
     * Helper function to return the current user account.
     */
    function admin_menu_environmental_get_current_user_account() {
      global $user;
      $account = $user;
      if (isset($_SESSION['masquerading'])) {
        $account = user_load($_SESSION['masquerading']);
      }
      return $account;
    }
    
  4. For the configuration form:
    This was indeed a bit unusual, but I wanted the user to be able to change any variable without reloading the page. Instead of using a weird logic for the #required property I'm now handling the validation myself. It will only pass validation if all three fields are filled out. And to inform the user about this I've set a little help text above the table.

@Anks

  1. In this case I don't think I have to go through check_plain() because the variables are all hardcoded in the array above:
      $fields = array(
        'bar_dark' => t('Bar dark'),
        'bar_light' => t('Bar light'),
        'bar_hover' => t('Bar hover'),
        'bar_active' => t('Bar active'),
        'dropdown_empty' => t('Dropdown empty'),
        'dropdown_container' => t('Dropdown container'),
        'dropdown_hover' => t('Dropdown hover'),
        'dropdown_border' => t('Dropdown border'),
      );
      // Build the color fields.
      foreach ($fields as $field_key => $field_title) {
        $form['colors']['admin_menu_environmental_colors'][$color][$field_key] = array(
          '#type' => $fieldtype,
          '#title' => $field_title,
          '#title_display' => $label_visibility,
          '#default_value' => isset($admin_menu_environmental_colors[$color][$field_key]) ? $admin_menu_environmental_colors[$color][$field_key] : '',
          '#size' => 7,
          '#field_prefix' => $field_prefix,
        );
      }
    
    

    Same goes for the new validation function where I use placeholders for !title and !number. These are also hardcoded, so no danger for XSS right?

  2. I've added the @file blocks to the rest of the files

@OPIN

  1. The icons was a thing I started, but don't really have time to complete. Maybe when this gets to full project state I will have another go at that. So for now I removed any references to the icons.
  2. On the administration configuration error I would like a little bit more feedback about how to replicate. I'm not able to... Maybe you are running admin_menu_environmental with the full realease of admin_menu instead of the dev version. If thats the cause for this error I will add a version requirement to my info file.
chris.smith’s picture

Status: Needs review » Needs work

Yes I was using the full version of admin_menu, not the development version. I received the error when I went to Home » Administration » Configuration » Administration on page http://localhost/#overlay=admin/config/administration/admin_menu. I also get this error when I'm using the dev version of admin_menu too. If you need anymore information please let me know.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. Feel free to reopen if you are still working on this application.

I'm a robot and this is an automated message from Project Applications Scraper.

PA robot’s picture

Issue summary: View changes

Added git clone command