This module adds a colored banner to the top and bottom of site indicating the Department of Defense level of content classification.
The four available levels are:
Unclassified (Green)
Classified (Yellow)
Top Secret (Red)
Custom
Custom allows you to select your banner color, and add your own custom text to the banner.
For now this a Drupal 6 module, but there will be a Drupal 7 release too.
The Project Page
The git repo: git clone --recursive --branch 6.x-1.x http://git.drupal.org/sandbox/bhosmer/1617760.git classified
PAReview results: http://ventral.org/pareview/httpgitdrupalorgsandboxbhosmer1617760git-6x-1x
As far as I know, there aren't any other modules that exist that offer this functionality or the ability to adapt this functionality. It is pretty specific, but the U.S. Government is getting really big with Drupal now and they asked for this.
[Review Bonus #1](http://drupal.org/node/1800900)
[Review Bous #2](http://drupal.org/node/1212602#comment-6599728)
[Review Bonus #3](http://drupal.org/node/1744562#comment-6599746)
[Review Bous #4](http://drupal.org/node/1486418#comment-6599762)
[Review Bonus #4.1](http://drupal.org/node/1486418#comment-6602768)
Round 2:
Bonus #1: http://drupal.org/node/1808474#comment-6638768
Bous #2: http://drupal.org/node/1820028#comment-6638872
Bonus #3: http://drupal.org/node/1820842#comment-6638936
Round 3:
Bonus #1: http://drupal.org/node/1808474#comment-6653634
Bonus #2: http://drupal.org/node/1820028#comment-6652484 (Patch included!)
Bonus #3: http://drupal.org/node/1668528#comment-6653658
Round 4:
Review Bonus #1: http://drupal.org/node/1800900#comment-6663074
Review Bonus #2: http://drupal.org/node/1791592#comment-6663148
Review Bonus #3: http://drupal.org/node/1671230#comment-6663266
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | drupalcs-result.txt | 4.42 KB | klausi |
Comments
Comment #1
bhosmer commentedI've created a 6.x branch: git clone --recursive --branch 6.x bhosmer@git.drupal.org:sandbox/bhosmer/1617760.git classified
Comment #2
bhosmer commentedReview Karma #1:
http://drupal.org/node/1800900#comment-6562458
Comment #2.0
bhosmer commentedUpdating original description.
Comment #3
bhosmer commentedPareview:
http://ventral.org/pareview/httpgitdrupalorgsandboxbhosmer1617760git-6x
Comment #4
jvdurme commentedHi bhosmer,
I installed the module and it seems to work as expected. Your module code seems good to me when I go through it, but a manual review by a professional reviewer is needed as well. Just wait a little...
I ran codesniffer and found no errors, but you already did that too.
Please rename README.md to README.txt and perhaps format the README.txt file a little. Here are a few examples of README files: http://drupal.org/node/447604
To make your project more sexy, format the project page in sections, as e.g. mentioned here: http://drupal.org/node/997024. Perhaps a demo page could be useful too.
I might have a tip. Right now the banners are stuck to the top and bottom of the page. So if you scroll the page, the banners scroll as well and you might end up with no banners on a certain part of the page. Perhaps an option to make the banners stick to be always visible could be a nice addition, similar to sticky table headers. Unfortunately I can't tell you how to do that right now. See for yourself if you find this useful or not. But I would like to have that option if I would use your module.
cheers,
Joost
Comment #5
bhosmer commentedHi @joost:
Thanks for the tips and the review.
I will rework the README and rename it as well.
That is great idea for the stickiness too. Maybe some jquery can help there?
I am actually updating the module right now to allow custom text and colors from a request for a client and I definitely still see a need for a Drupal 7 version.
Comment #6
jvdurme commentedStickiness will definately involve javascript, so indeed look in that direction.
Comment #6.0
jvdurme commentedWrong issue referenced.
Comment #6.1
bhosmer commentedAdding review bonuses.
Comment #7
bhosmer commentedI'm actually working on a rewrite now for a 6.x-1.x-dev idea to remove all of the javascript and use hook_footer for 6 instead of the javascript for some much better lowest common-denominator compatibility.
Comment #7.0
bhosmer commentedAdding third review bonus.
Comment #7.1
bhosmer commentedBonus #4
Comment #8
jvdurme commentedYou could do that, but keep in mind that hook_footer() doesn't exist in D7, but you know that I think.
Comment #9
bhosmer commentedQuite right. Thanks for the reminder.
Comment #10
bhosmer commented@joost
Coming back to this, and after removing the javascript, I think I will make both the top and bottom divs fixed with css. The sticky idea was a great idea and I appreciate your suggestion.
Comment #11
bhosmer commented@joost
Coming back to this, and after removing the javascript, I think I will make both the top and bottom divs fixed with css. The sticky idea was a great idea and I appreciate your suggestion.
Comment #11.0
bhosmer commentedMaking it easier for reviewers to clone the repo -- non-maintainer link added instead.
Comment #12
jvdurme commentedVery good! Using CSS it should work fine (just googled some stuff, hehe). I'm also interested in sticky stuff.
If other reviewers find stickiness not important, you should get approval soon with your bonus. Good luck.
Comment #13
bhosmer commentedIt works beautifully in 6! Check it out: http://drupalcode.org/sandbox/bhosmer/1617760.git/tree/refs/heads/6.x-1.... and using a fixed css position for the top and bottom divs. No javascript needed either!
Comment #14
jvdurme commentedAaah, yes man, this is very sharp.
I also noticed you have made a custom level, which is what I was going to ask for. :)
If you can commit this dev code to the 6.x-1.x branch and fix the CodeSniffer errors below, I will set it to RTBC.
Comment #15
jvdurme commentedSorry, wrong tag. ;)
Comment #16
bhosmer commentedI'll try to get those codesniffers snafus taken care of today. I was leaving my original 6.x branch alone, since the original project application only included that, but after deploying it high-side I realized there was a need for a custom setting.
I also got tied up yesterday with a 7.x branch using drupal_page_build. That will take a bit longer because the admin menu, if it is active, gets in the way.
Thanks for the review @jvdurme!
Comment #16.0
bhosmer commentedAdding review bonus comments.
Comment #17
bhosmer commentedI've updated per the PAReview suggestions: git clone --recursive --branch 6.x-1.x http://git.drupal.org/sandbox/bhosmer/1617760.git classified
http://ventral.org/pareview/httpgitdrupalorgsandboxbhosmer1617760git-6x-1x
Comment #17.0
bhosmer commentedUpdating branch in original application to 6.x-1.x
Comment #17.1
bhosmer commentedAdding new 6.x-1.x PAReview link.
Comment #18
jvdurme commentedAlmost there my friend.
In classified.install you have:
Change this to:
So change the typo 'uninstalled' to 'installed' and change the $t to $translated in drupal_set_message().
You should fix these issues, but since these are minor I'm setting this to RTBC.
cheers,
Joost
Comment #19
bhosmer commentedThanks for catching that! I've fixed them up: http://drupalcode.org/sandbox/bhosmer/1617760.git/commitdiff/96c03a25d15...
Comment #20
klausiThere is still a master branch, make sure to set the correct default branch: http://drupal.org/node/1659588 . Then remove the master branch, see also step 6 and 7 in http://drupal.org/node/1127732
Review of the 6.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. You have to get a review bonus to get a review from me.
manual review:
Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #21
bhosmer commentedThe code sniffer results only reported issues with a CSS file. It is my understanding that there aren't any hard and fast rules for CSS files correct?
Number 8:
Is a little confusing to me. Can you elaborate on what you mean? It seems contradictory.
I'll take care of your other suggestions (1-9) Thanks for the review.
Comment #22
jvdurme commentedHey bhosmer, klausi will most likely not view this thread unless you get a bonus and set this thread to needs review afterwards.
I wish I could answer your question, but it also confuses me.
Comment #23
bhosmer commentedThanks @jvdurme, I think I've handled it with the latest updates. I'm posting a fresh link now.
Comment #24
bhosmer commentedPer #20 I believe I have taken care of the issues brought up:
The Project Page
The git repo: git clone --recursive --branch 6.x-1.x http://git.drupal.org/sandbox/bhosmer/1617760.git classified
PAREVIEW Results: http://ventral.org/pareview/httpgitdrupalorgsandboxbhosmer1617760git-6x-1x
Comment #25
bhosmer commentedChanging tag.
Comment #26
bhosmer commentedBonus #1: http://drupal.org/node/1808474#comment-6638768
Bous #2: http://drupal.org/node/1820028#comment-6638872
Bonus #3: http://drupal.org/node/1820842#comment-6638936
Comment #27
bhosmer commented#26 for Review Bonus
Comment #28
mpdonadioThis means that in classified_footer() you are directly outputting variables that were entered into a settings form. You could craft input that would add arbitrary JS to the page.
Since your settings path has "administer site configuration" for the access permission, this isn't a true security problem since "administer site configuration" can do pretty much anything to the site anyway. If you ever add your own explicit permission for this path, then you could potentially have a problem.
As a precaution and best practice, you should sanitize everything a user inputs (as needed) via the UI when you render page output.
Comment #29
bhosmer commentedThanks Matthew. I think my latest 6.x-1.x takes care of that right?
Comment #30
mpdonadioLooking at the 6.x-1.x that I just pulled.
In classified_footer(), custom_classification_color gets used directly. Even though you set this with a radio, it may be possible to bypass this with a custom POST, and then you use it directly. It is also a good idea to future proof a change, so a change in one place doesn't require a change someplace else. This is being paranoid, though. I think klausi was talking about custom_classification_text, which you did handle.
It is also a good idea to use the same prefix for all your variables, which is the same as your module name. This prevents any namespace collision. Don't forget to also update the hook_uninstall if you change them.
BTW, the conditional on lime 131 in classified.module will always evaluate as TRUE with the way it is written.
Comment #31
bailey86 commentedI think on L131 of classified.module he meant to have:
And shouldn't the levels be stored as numeric values not strings.
To be consistent the the case statements should be
case '0'
case '1'
etc.
Comment #32
bailey86 commentedReview of classified.
Description.
The description is a bit vague. OK - So it puts colored banners at the top and bottom - but how does it know which colors to apply?
Do you select the color by using tags - or is it a field you add to your content types. Or is it something which is tied to your user level/role and is there permanently after you have logged in? Explaining this at the description level would make users approaching this module a bit clearer on *how* the module operates.
And what is the overall purpose of the module - is it so that the user is easily aware of the classification level of the content they are viewing - or is it so that supervisors can easily see the level of documents which are being viewed by their staff - i.e. they can look around the room to see what level of stuff people are looking at.
Coding standards.
It's important to make sure that the module passes all coding standard tests on ventral.org. If there is no output then we're OK - if there is any output then it needs to be looked into - which is time consuming. There is no reason you shouldn't be able to sort out the coding standards issues - they are fairly easy to resolve.
Here is the report - http://ventral.org/node/94256/revisions/109792/view
The errors are really basic - there should be the correct number of spaces used for indentation - and spaces should be used not tabs. Listing of CSS properties in alphabetical order is important when you have CSS with large numbers of attributes set. If it helps - there is a really good Drupal mode for Emacs - I've blogged about it here - http://www.freewayprojects.com/2011/12/for-all-drupal-devlopers-who-use-...
Once you see how the indentation should be it becomes second nature - for details about the coding standards look at:
http://drupal.org/coding-standards
http://drupal.org/node/302199
Branches
The branches are not correct - currently they are:
You should rename the 7.x branch to 7.x-1.x
classified.install
A comment on '$t = get_t();' would be nice to explain why it is there.
You call a function without the '$message = ' and '$type = ' parts.
drupal_set_message($message = $translated, $type = 'status');
should be
drupal_set_message($translated, 'status');
Similarly
drupal_set_message($message = t('The classified module was successfully disabled.'), $type = 'status');
should be
drupal_set_message(t('The classified module was successfully disabled.'), 'status');
classified.module
function classified_footer() has no comments. It's fairly easy to see what is there but I'm a bit concerned that you seem to be forgetting comments altogether.
README.txt
The installation and administration instructions are confusing.
'Enable it' should be more detailed - 'Enable the module at Administer - Site building - Modules (admin/build/modules)'
You've then mentioned enabling it twice.
When you get to admin/settings/classified the currently selected options should be filled in already - currently the radio buttons are all empty. Once you've saved something they are soved correctly and re-presented.
Reset to defaults empties out the radio buttons - again, they should be set to the default values.
Other than these points the module seems to work without errors.
My only concern is that the module is a little small to be really allowed to set you up as a Drupal contributor - but one of the other guys will decide that issue. Also, some of the coding shows that you are new to writing code - I would suggest some decent PHP books or a course to get up to speed.
A couple of points to note:
* Comments are a crucial part of proper code - not some sort of luxury add-on.
* Calling functions is different from declaring them - check out http://www.php.net/manual/en/functions.arguments.php#functions.arguments...
* It's not normally necessary to put underscores in from of variable names - variables are only available in the scope of the function they are sitting in. Underscores are normally used for private methods in object declarations. See: http://php.net/manual/en/language.variables.scope.php
Don't want to sound too negative - module is small and does do its job. The job is a little limited - but I think it is filling a requirement so that is always good!
Comment #33
bhosmer commentedThanks for your constructive comments. I definitely don't try to sell myself as a top-coder and appreciate any and all suggestions and tips!
I've removed the 7.x branch to eliminate some of the confusion.
I also have fixed the issue with the default clearing of the form in my latest.
I'll be updating the README to make it more clear as well.
When this module is approved I certainly intend to release it as alpha, to hopefully harness the power of the community to make it better. I'm not saying it is perfect now, and as you pointed out, it certainly can be made better. This is what I am hoping to do with this project application. Get it exposed so that other organizations and agencies can find it, use it, and contribute back to it.
I'm thankful for your comments, because they are constructive and offer sage advice from someone more knowledgable than I am. I sincerely do appreciate the large amount of time you took.
Comment #34
klausimanual review:
Settings this back to "needs work", you need to know where to use check_plain() and where not. I think you are pretty close otherwise, fix those issues and you should be ready. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #35
bhosmer commentedLatest PAReview: http://ventral.org/pareview/httpgitdrupalorgsandboxbhosmer1617760git-6x-1x
Bonus #1: http://drupal.org/node/1808474#comment-6653634
Bonus #2: http://drupal.org/node/1820028#comment-6652484 (Patch included!)
Bonus #3: http://drupal.org/node/1668528#comment-6653658
Comment #36
bhosmer commentedChanging to needs review.
Comment #37
klausiPlease add all your reviews to the issue summary.
Looks RTBC to me. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #38
bhosmer commentedI am assuming that I need three more bonuses to get from "RTBC" to "fixed"?
Review Bonus #1: http://drupal.org/node/1800900#comment-6663074
Review Bonus #2: http://drupal.org/node/1791592#comment-6663148
Review Bonus #3: http://drupal.org/node/1671230#comment-6663266
Comment #39
bhosmer commentedAdding bonus tag.
Comment #39.0
bhosmer commentedUpdating description to include custom setting.
Comment #39.1
bhosmer commentedadding review bonus
Comment #40
jvdurme commentedHi bhosmer, when there are no issues from other reviewers for more than a week, klausi will set it to fixed.
Comment #41
bhosmer commentedOh, okay. Thanks for clarifying.
Comment #42
klausino objections for more than a week, so ...
Thanks for your contribution, bhosmer!
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, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #43
jvdurme commentedCongrats bhosmer! Good feeling right? :-)
Comment #44
bhosmer commentedYes @jvdurme, it is a good feeling. Thanks a lot for your help and everyone else too!
Comment #45.0
(not verified) commentedAdd all review bonus'