A webform component that lets the user select a country out of a list that you can configure.
To configure, you choose a set of countries (out of the complete list of all countries) that can be selected. You can also change the order in which they appear in the select box.
Project page
Sandbox
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/matthias_mo/2294933.git webform_country_list
cd webform_country_list
PAReview
http://pareview.sh/pareview/httpgitdrupalorgsandboxmatthiasmo2294933git
Other projects
Since more than a year I'm the maintainer of the webform_confirm_email module.
Reviews of other project applications
Comment | File | Size | Author |
---|---|---|---|
#51 | webform-countrycode-Submission 1 drupal7.dev_.png | 229.21 KB | naveenvalecha |
#50 | webform-countrycode-Submission 1 drupal7.dev_.png | 229.21 KB | naveenvalecha |
#15 | Screen Shot 2014-07-28 at 11.12.52.png | 594.41 KB | vanyamtv |
#33 | Screenshot_2.jpg | 22.35 KB | robin.ingelbrecht |
#38 | result.png | 10.79 KB | sumitmadan |
Comments
Comment #1
PA robot CreditAttribution: PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxmatthias_mo2294933git
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #2
phaer CreditAttribution: phaer commentedHi,
Nice work! As far as I know, there's no other country list component for webform and it's a simple and readable module.
webform_options_countries()
seems to be just an alias for two lines using drupals core country list (source. Cores country list is editable with https://www.drupal.org/project/countries, you could mention that in your README.txt_
does no harm, but please fix the CodeSniffer issues.theme_country_list_form()
. Is there a reason for this? I think exclusive usage of renderable arrays would be the drupal-way.if (empty($available_countries)) {
instead ofif (count($available_countries) == 0) {
isset($component['weight']) == TRUE ? $component['weight'] : 0,
toisset($component['weight']) ? $component['weight'] : 0,
,== TRUE
is redunant here.&
to line 36 of the .module file$avail_countries = $component['extra']['available_countries'];
, you should be able to reuse it in line 49 ('#default_value' => !empty($component['extra']...
which is a bit too long at the moment. Please keep lines below 80 characters if possible._webform_edit_country_list()
would be even more readable if you'd alias$form['country_list'][$delta]
to something shorter like$country_form
Comment #3
matthias_mo CreditAttribution: matthias_mo commentedHi!
Thank you @phaer for reviewing. I incorporated most of your suggestions.
Regarding your 3rd point - "You use some renderable arrays mixed with some hardcored HTML":
Thank you for taking the time!
Comment #4
matthias_mo CreditAttribution: matthias_mo commentedComment #5
matthias_mo CreditAttribution: matthias_mo commentedJust for the record, all issues from pareview have been addressed except those that I think should be left as is:
</lable>
tag intentionally on a separate line for better readabilityComment #6
matthias_mo CreditAttribution: matthias_mo commentedComment #7
matthias_mo CreditAttribution: matthias_mo commentedComment #8
matthias_mo CreditAttribution: matthias_mo commentedComment #9
matthias_mo CreditAttribution: matthias_mo commentedComment #10
matthias_mo CreditAttribution: matthias_mo commentedComment #11
matthias_mo CreditAttribution: matthias_mo commentedComment #12
er.pushpinderrana CreditAttribution: er.pushpinderrana commented@matthias_mo, first of all thanks for your contribution!
Nice Module!
Manual Reviews:
Few things I noticed in your module.
1. You are adding
webform_country_list.css
using.info
file, it would be better to add css using #attached.2. You are adding '@' with following function to avoid warnings, it would be better add a single line comment above to this code for better understanding.
3. Add hook_help() in your module and also describe about
geoip_country_code_by_name
function there for better understanding.Rest looks good to me! I am not moving this to "Need Works" as there is not any blocker.
Thanks Again!
Comment #13
matthias_mo CreditAttribution: matthias_mo commentedThank you er.pushpinderrana,
I think I fixed all issues that you reported.
Thank you for taking the time to look at my code.
best
Comment #14
matthias_mo CreditAttribution: matthias_mo commentedComment #15
vanyamtv CreditAttribution: vanyamtv commented1. "Country list" field description is not shown at all.
2. While editing the "Country list" field, after it was already saved, you'll get an error messages like "Weight for row n must be an integer." (see the screenshot)
3. Would be great to add possibility to don't select any of the countries. For example to have functionality to add a label, like "- Please select a country -", for example.
4. Is the country names translatable?
Thanks:)
Comment #16
matthias_mo CreditAttribution: matthias_mo commentedThanx for testing out my module @vanyamtv!
@ 1.) is now fixed in the git repo
@ 2.) I cannot reproduce it, I'd need more detail instructions how you got there
@ 3.) hmm. I have to think about that, not shure whether I want that behavior. But thanx for pointing out.
@ 4.) yes they are. They're defined in core, includes/iso.inc using the t() function
Thank you for your review!
Comment #17
matthias_mo CreditAttribution: matthias_mo commentedComment #18
vanyamtv CreditAttribution: vanyamtv commented2) Well: just add new filed of type "Country list", don't rearrange the order of the countries, then click save and you'll get 250 error messages.
Environment: PHP Version 5.3.28, Drupal 7.30, Webform 7.x-3.20
Comment #19
matthias_mo CreditAttribution: matthias_mo commented@vanyamtv Tried it again, and no, no errors
Comment #20
matthias_mo CreditAttribution: matthias_mo commented@vanyamtv I just mad a complete new minimal drupal 7.30 installation and tested it in every way I could think of. I never got error messages.
Please provide detailed step by step instructions how to reproduce this problem.
Comment #21
vanyamtv CreditAttribution: vanyamtv commentedhttps://www.youtube.com/watch?v=uwr4aBnw-84
Comment #22
matthias_mo CreditAttribution: matthias_mo commented@vanyamtv thank you for the screen cast, but I believed you also before ;-)
As I told you already I cannot reproduce your problem. I tried it on another machine, followed exactly your steps and still get no errors.
I also searched the error strings and I can't find them neither in drupal core nor in the webform module. For me the look like some validation function output, so do have some special client side form validation running on your installation?
So can I ask you to make a new, clean installation of Drupal and try it there?
And if it still persists, can you debug it some more to give me some pointers where to look for?
And do you have the latest version of the module? I did some updates during the last 2 weeks ...
I also suggest to leave this application at "Needs review" as sofar none else than you has this problem and I'd like to have a report from someone else on whether he/she can reproduce the problem you reported.
Comment #23
vanyamtv CreditAttribution: vanyamtv commentedAll right:
1) The error message comes from:
File /sites/all/modules/webform/components/number.inc
Line number: 594
form_error($element, t('%name field value of @value must be an integer.', array('%name' => $element['#title'], '@value' => $value)));
2) In order to fix the bug:
File: /sites/all/modules/webform_country_list/webform_country_list.module
Line number: 76
'#default_value' => isset($country['_weight']) ? $country['_weight'] : $delta,
Should be changed to:
'#default_value' => (is_array($country) && isset($country['_weight'])) ? $country['_weight'] : $delta,
Because:
if $country is string isset($country['_weight']) returns true in my case. Could be explained like (int)'_weight' = 0. So default value in that case will be the first letter of the country name.
Comment #24
matthias_mo CreditAttribution: matthias_mo commented@vanyamtv
You were right, the code was wrong. I copied it from field.form.inc and didn't rework it completely. The whole conditional is useless.
I'm still surprised that I didn't see the warnings you got. I checked whether they were turned of in /admin/config/development/logging but no, all error messages and warnings are switched on. So the only thing the remains is the PHP version, I'm using 5.5.12
Thanx for finding this bug and being persistend ;-)
Comment #25
vanyamtv CreditAttribution: vanyamtv commentedYou're welcome:)
Comment #26
matthias_mo CreditAttribution: matthias_mo commentedComment #27
klausiReview of the 7.x-1.x branch (commit 7bcadec):
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:
<script>alert('XSS');</script>
as description for the webform field there will be a nasty javascript popup when the webform is displayed. You need to sanitize #description before printing, make sure to read https://www.drupal.org/node/28984 again. And please don't remove the security tag, we keep that for statistics and to show examples of security problems.Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #28
matthias_mo CreditAttribution: matthias_mo commentedthank you @klausi for the review and the insight.
I fixed the issues you reported.
Comment #29
matthias_mo CreditAttribution: matthias_mo commentedThis project application has now seen 4 reviews, all required changes have been made.
According to How to review Full Project applications I changed the priority to "Major".
It seems that this project is ready to become a full project, hence I kindly ask to give it a go.
Comment #30
matthias_mo CreditAttribution: matthias_mo commentedIt's now been 4 weeks since the last review, I kindly ask again to approve my project application.
Comment #31
er.pushpinderrana CreditAttribution: er.pushpinderrana commented@matthias_mo, Getting another review bonus will help speed up the process and make sure it gets on the review admins radar.
Comment #32
naveenvalechaHi @matthias_mo,
thanks for your contribution!
Nice Module!
Automated Review
Best practice issues identified by pareview.sh / drupalcs / coder.Some minor nutpicks please fix but regarding the functions naming conventions is fine because functions provided by the webform module. http://pareview.sh/pareview/httpgitdrupalorgsandboxmatthiasmo2294933git
Manual Review
This review uses the Project Application Review Template.
As I am not a git admin, please help to review other project applications to get another review bonus. This will put you on the high priority list, then git administrators will take a look at your project right away :-)
I have not seen any release blocker. So +1 for RTBC.
Thanks Again!
Comment #33
robin.ingelbrecht CreditAttribution: robin.ingelbrecht commentedHi matthias_mo,
I Installed the module and configured a webform. When going to the webform I got following notices:
Also, wouldn't it be nice to have a button check/uncheck all?
Comment #34
naveenvalecha@robin.ingelbrecht,
Thanks for checking.I did not see this error while review.Also I cannot reproduce this now.Please offer more details.
Thanks Again!
As this is not the release blocker so I have added a feature request in the module issues https://www.drupal.org/node/2346821
Comment #35
matthias_mo CreditAttribution: matthias_mo commentedyes that was a bug @robin.ingelbrecht, thanks for reporting
Comment #36
davidam CreditAttribution: davidam commentedIn this moment I can see this problems in the pareview:
Comment #37
klausiThose are webform coding conventions and not application blockers, please do a real manual review of the source code.
Comment #38
sumitmadan CreditAttribution: sumitmadan commentedHi @matthias_mo,
I have added the "country list" component and its working fine on webform page. But why no result/mail is for country selected?
See attached screenshot.
Comment #39
matthias_mo CreditAttribution: matthias_mo commented@sumitmadan : because the hooks _webform_table_country_list and _webform_display_country_list have not been implemented yet, please add a feature request. I'm still waiting for my project application to be accepted, after that I'll continue to add features (like this).
Comment #40
sumitmadan CreditAttribution: sumitmadan commented@matthias_mo result is an important thing for webform component, otherwise no use of this module. I think you have to add this feature and make it useful for others.
Comment #41
matthias_mo CreditAttribution: matthias_mo commented@sumitmadan I added the feature request.
Comment #42
druliner CreditAttribution: druliner commentedHey @matthias_mo:
This sounds like a great module. I installed it and created a couple of webforms and it works as advertised. However I would have to agree with @sumitmadan. This module is probably of little use to anyone if the component's data is not saved.
Comment #43
matthias_mo CreditAttribution: matthias_mo commented@druliner the setup of the webform component (that is - which countries are available for selecting) as well as the webform submission data (which country the user selected) *IS* saved in the database. The only thing that's missing is the implementation of the hook that displays the user submitted data for this component in the webform results. So I do think the modul is useful already.
As I've already noted I'm happy to implement these hooks for the webform results, actually I have several other ideas of how to make this module more pleasant to use. But I already put more time into this "full project rights application" as is justified for such a simple and small module so for now I put everything on hold and wait.
Comment #44
Watergate CreditAttribution: Watergate commentedComment #45
Watergate CreditAttribution: Watergate commentedHi matthias_mo,
I've read the previous comments and see that you are eager to start deploying your project. However, I do agree with sumitmadan and druliner that submission results should be easily visible for site administrators (i.e., project application reviewers). I don't consider this as functionality that could/should be added later, because it involves 'security-vulnerable' code (i.e., outputting user entered content). If you ask me, having extra pair of eyes looking at this specific code should be considered as more than welcome, and that is what reviewers do ;) Since I like to help you move on with the project, I have created a patch that implements this functionality, see #2360777: Basic output of webform results
To speed up the review proces, I encourage you to get another review bonus. This will get your project request on the high priority list, and it will stay there!
Below you can find (the rest of) my review using the Project Application Review Template.
Let me know if you need some clarification on my feedback.
Manual Review
package = Webform
, so that the module is listed along with the other Webform modules (when installing).webform_country_list_webform_component_info()
you specify that the component can be required (i.e., that a visitor has to select a value). So I think you either should remove the ability that your component can be marked required or implement (correct) #empty_option behavior (maybe with the$geoip_ctry_code
as the first option to select).'#title_display' => $component['extra']['title_display'] ? $component['extra']['title_display'] : 'before',
in the array of the form element in_webform_render_country_list()
solves this problem.'#theme_wrappers' => array('webform_element'),
into the array of the form element in_webform_render_country_list()
solves this problem._webform_edit_country_list()
), or applyusort()
in_webform_country_list_edit_validate()
._webform_country_list_cmp_weights()
,theme_country_list_form()
(use @param and @return tag)._webform_theme_component()
should be used instead ofhook_theme()
, see _webform_theme_component documentation. The patch in #2360777: Basic output of webform results already fixes this!The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.
This review uses the Project Application Review Template.
Comment #46
matthias_mo CreditAttribution: matthias_mo commentedHi Niels,
first of all, thank you for the extended amount of effort you put in the review, it was very much appreciated! Thank you also for the insight! For shure I commited your patch.
I know, I was reminded many times. But my previous experience with it was so unpleasand that I lost interest in the "review bonus".
I added documentation in the README and the project site.
I went through your list and applied the changes as you suggested.
I use the GeoIP package for the simple reason that it comes packaged for several Linux distributions and hence is widely used (and hence tested).
Done.
I don't need the required feature, I removed it.
Done.
Done.
I went through the code and enhanced the documentation.
I applied your patch, thanx again for the work!
Once again, thank you for this helpful review.
Comment #47
matthias_mo CreditAttribution: matthias_mo commentedComment #48
naveenvalechaAwesome module!.Thanks for ur contributions.
+1 for RTBC.
Few more minors
include_once DRUPAL_ROOT . '/includes/locale.inc';
include_once DRUPAL_ROOT . '/includes/locale.inc';
Comment #49
klausi@naveenvalecha: module_load_include() should only be used for modules, but that file is not part of a module, so this looks correct as is.
Also: did you forget to set this to RTBC?
Comment #50
naveenvalecha@kalusi,
Have not seen any release blocker to the module.Rest seems good to me.Setting this RTBC :)
Some Codesniffer issues :
Suggestions
Comment #51
naveenvalechaWebform component edit form.The checkboxes should be aligned with the table header.I would suggest to use the different table columns in theme_country_list_form and remove the column borders using css.That seems to be a better approach.
See the problem in the attached screenshot.
This is not a release blocker.So the status will remain same.So you do the changes accordingly to make it looks good.
Comment #52
matthias_mo CreditAttribution: matthias_mo commented@naveenvalecha thank you for reviewing my module!
As mentioned in comment #5 I respectfully disagree with pareview.sh about formating these lines.
Sounds reasonable, I put it on my TODO list.
Yes, there is the feature request for this. I'll implement that.
This was suggested by pareview.sh. It seemed consistent with the other parameter type declarations to me.
Thanx again for your review!
Comment #53
naveenvalechaThese are not release blockers.
I think if you will address the #51 This will also fix these errors as well.
Comment #54
matthias_mo CreditAttribution: matthias_mo commentedComment #55
klausiSorry for the delay. Reviewing more project applications and a new review bonus will get applications finished faster.
manual review:
But otherwise looks good to me.
Thanks for your contribution, matthias_mo!
I updated your account so you can 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 stay 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 #56
matthias_mo CreditAttribution: matthias_mo commentedHi @klausi,
thank you for promoting my account.
There is no reason why PHP errors from geoip should be suppressed so I changed it.