Project summary
Generates a toolbar (aka dropdown menu) from a custom menu. Visible only to selected roles.
Why?
I believe its a very good idea to create a custom administration menu for the users that are going to create content. I also believe its a very good idea to place such a menu in the top of the browser as a toolbar. This module makes it quick to place a custom menu as a toolbar.
Similar?
Why not just use the "admin_menu" module?
Admin menu doesn't allow you to customize the menu to reflect the needs for the specific webmaster on the specific site. Having a customized menu is valuable, because it makes it quick to do the tasks that you need doing. Tasks that are less used can be put into submenus or sub-sub menus.
Why not just use the core "shortcut" module?
Shortcuts cannot be organized in hierarchally
Why not just create the custom menu and restrict its visibility to a certain role in blocks?
This is fine, if you want the Webmaster menu to display in same fashion as the rest of your menus. But if you want it as a toolbar, you have to create separate css for this - and to reduce load, you should also set it up, so this css only loads when needed. This module spares you the trouble. Bang - there's your toolbar!
Project page
http://drupal.org/sandbox/rosell/1417602
Git clone
git clone --branch master rosell@git.drupal.org:sandbox/rosell/1417602.git webmaster_menu
Version
The module is for D7
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | webmaster-menu.png | 46.89 KB | rosell.dk |
| #1 | drupalcs-result-1420358.txt | 1.07 KB | morgothz |
Comments
Comment #1
morgothz commentedIt appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
Review of the master branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Get a review bonus and we will come back to your application sooner.
Comment #2
morgothz commentedNow you have a 7.x-1.x branch, instead of master branch.
You must delete all files in master branch. Follow guidelines, see step 5 in http://drupal.org/node/1127732.
You must remove useless comments like:
// ------------------fLine 14 (webmaster_menu.config_page.incHave you consider user system_settings_form() instead of manually set system variables?
Comment #3
rosell.dk commentedOk. Thanks for a quick reply.
I have moved the module to a new 7.x-1.x branch.
I also fixed the style complaint by PAReview.sh.
The other complaint by PAReview.sh goes like this:
sites/all/modules/pareview_temp/test_candidate/./webmaster_menu.install:
+12: [critical] Potential problem: drupal_set_message() only accepts filtered text, be sure all !placeholders for $variables in t() are fully sanitized using check_plain(), filter_xss() or similar.
The code that it complains about goes like this:
drupal_set_message(st("Webmaster menu was installed. It can be configured here: !link",
array('!link' => l(st('Administration > Configuration > Administration > Webmaster menu'), 'admin/config/administration/webmaster_menu'))
));
There should be no need to do a check_plain() here, because there is complete control of the string. There is thus nothing to fix regarding that complaint - its a false positive.
Comment #4
morgothz commentedHi!
Master branch still contains files.
See #2 and follow guidelines to set master branch only with README.txt file.
Comment #5
rosell.dk commentedWow, you are fast...
- The master branch is now empty, besides the README.txt, which now is like described in step 5 in http://drupal.org/node/1127732
- I removed the "-----------" lines. Their purpose was to organize the code of the into sections - but it really didn't make sense here. So, gone are they.
Regarding using system_settings_form(), I actually started out using it. I abandoned it, because I wanted more control with what is stored in the variables. The automatics of the system_settings_form also stores the values from checkboxes that are not selected (they get value: 0). This is an unnecessary complex datastructure. Its clearer and easier to understand (and thus less prone to bugs), if the selected role ids simply are stored as an array of role ids. So, thats why I can't use system_settings_form().
But your question got me digging into the internals of system_settings_form, which resulted in a little optimization of the configuration form - I didn't know about array_filter(), and I didn't know that variable_set() could store arrays.
Comment #6
rosell.dk commentedComment #7
rosell.dk commentedOops. Wanted to attach the image to the issue, not to the comment. And didn't want to change status...
Comment #8
tyler.frankenstein commentedI cloned the D7 version of the webmaster menu module on a fresh localhost install. The module installed fine via Drush.
I then created an example menu called 'Quick Toolbar' and added a few basic links to it (login, register). I then went to the webmaster menu configure form and specified my 'Quick Toolbar' menu to be used as the webmaster menu and specified it could be seen by anonymous users.
This was my first test case, and it worked as expected. I then began flipping on/off the other options available on the webmaster menu screen, adjusting the user role visibility settings, the 'add home link', the 'add logout link' and performing tests for each. The behavior worked as expected for each test case.
One odd thing I noticed was the webmaster menu still rendered itself even when there were no links to show. For example, an authenticated user still sees the webmaster menu (empty) when the only links in the 'Quick Toolbar' menu are user/login and user/register. I would expect the webmaster menu to be hidden in this case.
I then tried the 'add an extra menu to the webmaster toolbar' and added the 'Main menu' (which I placed a few links to devel generate nodes in) to the webmaster toolbar as well. It did bring in the links from the 'Main menu' and also provided the links from the 'Quick toolbar' menu, as expected.
This is a neat little module, I could see it being useful for beginners as an easy way to get a toolbar. I would like to see it have drop down capabilities. For example, I would picture my 'Quick Toolbar' to be listed in the toolbar as a menu link, then when a user clicks/hovers over it it would pop up the mneu items (login,register). Then if the 'Main Menu' was clicked/hovered, it would popup the links I had added to my nodes. This is how I pictured the module would work in my head before playing around with it. (but that's just me) Additionally, it would be nice to see some selectable color options for the background of the webmaster menu (in the future of course).
The module uninstalled cleanly via drush as well.
There are some minor suggestions from PAReview here: http://ventral.org/pareview/httpgitdrupalorgsandboxrosell1417602git
Comment #9
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Get a review bonus and we will come back to your application sooner.
manual review:
The security issue is a blocker, otherwise this looks nearly ready to me.
Comment #10
rosell.dk commentedThanks for your reviews!
- I fixed the security issue regarding user_roles(FALSE)
- I added functionality that prevents menu from being shown when it contains no links besides home and logout
- I fixed the style issue (webmaster_menu.css)
I have also been thinking about adding option for colours. For example in a way, so the colour depends on role. I have however also been thinking about adding extra stylesheets so the user easily can choose between different styles. These ideas kind of overlap, so I'll wait with the implementation till I feel sure which way is best.
Regarding dropdown capabilities: The module does indeed have this. If the links in the menu you specify as root menu have children, they will pop up as a dropdown menu.
Regarding using the system_settings_form(), I have a particular reason not to use it - namely that I only want to store role ids as a simple array.
Regarding the other issue reported by PAReview (in webmaster_menu.install), its a false positive.
Comment #11
luxpaparazzi commentedIMHO this module looks ok. I don't see any security flaws, and no bad practices.
There is only one minor thing which should be corrected as detected by drupalcs:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Get a review bonus and we will come back to your application sooner.
Comment #12
luxpaparazzi commented... well yes probably variables should all be sanitized on output ... see http://drupal.org/node/28984
... as I do not have much time now, I'll recheck this later an leave the status as-is.
Comment #13
luxpaparazzi commentedUndoing my status change.
Comment #14
novalnet commentedHi,
Manual Review:
webmaster_menu.install :
1. Do not use t() or st() in installation phase hooks, use $t = get_t() to retrieve the appropriate localization function name.
2. function webmaster_menu_install() contains a Potential problem .drupal_set_message() only accepts filtered text, so be sure the !placeholders for $variables in t() are fully sanitized.
3. If your Line exceeds 80 characters, make it as 2 lines.
webmaster_menu.css :
You should follow alphabetical order for Multiple CSS properties.
Comment #15
exlin commentedUse of st should be ok in this situation.
Comment #16
exratione commentedI looked this over - few things to say, as it generally looks good.
1) That st() in webmaster_menu_install() should definitely be done via $t = get_t() then use $t() as the function call. Install hooks can be called either during a profile installation of Drupal or after Drupal is fully installed. Ergo, use get_t(), as t() is not going to work when modules are installed during an installation of Drupal.
2) It looks like you could give anonymous users access to the menu, and also configure it to have a logout link - and do both at the same time. So should you prevent that from happening somewhere in the options, or by checking to see if the user is logged in when showing that link in the menu?
I don't see any issues with sanitization of output in the theme functions - things that luxpaparazzi pointed out are getting passed into l(), which does check_plain() the text and check_url() the url.
Comment #17
rosell.dk commentedHi,
- Now using get_t() instead of st() in webmaster_menu_install()
- Now only displaying "Log out" if user is logged in
- Fixed code style issues
Comment #18
exratione commentedOk then, don't see why we can't set this to reviewed and tested by the community.
Comment #19
klausiWe are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and I'll take a look at your project right away :-)
Comment #20
mitchell commentedThanks for your contribution, rosell.dk!
I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on irc in #drupal-contribute. So, come hang out and get involved!
Thanks as well to the participants here for your reviews and assistance to rosell.dk!!
Comment #21
rosell.dk commentedHi mitchell,
It seems that I haven't got permission to create full projects. There is no "promote" subtab under the edit tab on the sandbox page, and the "sandbox" checkbox on the "create new project" is greyed out. Can you please check that you updated my account correctly?
Thanks in advance - and thanks for approving me :)
/ Bjørn
Comment #22
mitchell commentedThanks for your patience, Bjørn. You should be all set now.
Comment #22.0
mitchell commentedFormatted the description for better overview
Comment #23.0
(not verified) commentedminor change in description