Description
How many times have you visited a website where an option would reveal itself unavailable only after the page was submitted? It is said a monk fails to become priest every time a website behaves like that. It is a big concern on usability the showing of options that are indeed forbidden to the current user, and this module exorcises part of the manifestations of such evil.
Objective
Tefiltro module improves the usability of your Drupal 7 website through a process of term filtering. It hides from the "options list" of a "term reference" field, those options the visitor will not be able to choose under certain scenarios (Vide Scenario bellow).
It hides the options that represent terms not referenced at nodes authored by:
- current user
OR - members of the oldest organic group owned by current user.
Scenario
Visitor wants to choose driving (node drive) some of his several cars (node car) according to their colors (vocabulary color). Each car has a term reference to a color, but not all colors stored in the vocabulary represent the cars owned by Visitor. He would like to filter the select options list to the colors of his own cars, or to the colors of the cars of his friends.
Usage
Tefiltro filters the options list of a term reference filed in a node add/edit form. Configure admin/config/content/tefiltro. Fill the form with:
- Target Field,
- Origin Field and
- Target Content Type.
Note: Target Field is the field used to select previsouly created terms, while Origin Field is the term reference field used to create terms that will be then selected by Target Field.
Step-by-Step
Although this is a very simple module, its usage can be trick unless you have faced the filtering needings it solves. For overcoming that read the step-by-step guide in the README.txt file. You are also invited for the Tefiltro Informal Presentation.
git clone http://git.drupal.org/sandbox/panchiniak/1521136.git tefiltro --branch 7.x-1.x
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | pareview.txt | 1.02 KB | anwar_max |
Comments
Comment #1
musikpirat commentedHi rodrigo,
Please add a git clone link to the issue.
It seems you are working in a master branch. Please fix that, you can find a description here.
Ventral found a bunch of other issues, please fix them.
It will speed up the review process, if you get a Review bonus.
Do not assign the issue to yourself, this is meant for the one doing an in depth review.
Comment #2
amauric commentedHi,
Posted at the same time that @musikpirats. I edit to avoid duplication.
Comment #3
patrickd commented@1002Studio // thanks!
please don't paste these clumsy automated reviews in here, please edit you last comment and short it
@rodrigo please, switch to a version specific branch before switching back to needs review
Comment #4
rodrigo panchiniak fernandes commentedThank you @patrickd,
Project is updated to right branch and style comment errors posted before by @musikpirat.
Switching back to "needs review".
Comment #5
rodrigo panchiniak fernandes commentedThank you musikpirat,
Ventral comment issues were corrected:
http://ventral.org/pareview/httpgitdrupalorgsandboxpanchiniak1521136git
Comment #6
chhavik commentedManual Review :-
Comment #6.0
chhavik commentedAdded git clone
Comment #7
rodrigo panchiniak fernandes commentedThank you by your kind review,
hook_uninstall() added and unnecessary $user->uid removed.
Comment #7.0
rodrigo panchiniak fernandes commentedcorrected branch
Comment #8
alesr commentedManual review:
You are mixing languages in your code:
There are some mixed english and spanish comments too. Please rewrite the comments in english, so other non-spanish people can understand your module and help commiting.
Comment #9
rodrigo panchiniak fernandes commentedThank you alesr,
It was pt-br. Everything is provided in English now.
Comment #9.0
rodrigo panchiniak fernandes commentedword choice
Comment #9.1
rodrigo panchiniak fernandes commentedtypo
Comment #10
rodrigo panchiniak fernandes commentedAdding "PAReview: review bonus" issue tag.
Comment #11
soncco commentedThere's still portuguese comments, comments and variable names should be in English, and use US English spelling. See http://drupal.org/node/1354#general.
Comment #12
rodrigo panchiniak fernandes commentedThank you soncco,
Erased all Brazilian Portuguese translations from comments.
Comment #13
rodrigo panchiniak fernandes commentedCorrected the style.
Comment #14
klausiRemoving review bonus tag, you did not do any actual manual reviews, you just pointed out some missing git links. Please see http://drupal.org/node/894256
Comment #15
revagomes commentedRodrigo,
Please check out the README file again because I think you misspelled the node type name "drive" on the item 6 of the step-by-step section.
Comment #16
rodrigo panchiniak fernandes commentedThank you revagomes!
Replaced "ride" by "drive".
Comment #16.0
rodrigo panchiniak fernandes commentedReviews of other projects
Comment #16.1
rodrigo panchiniak fernandes commentedShortened
Comment #16.2
rodrigo panchiniak fernandes commentedReplaced use by choose
Comment #16.3
rodrigo panchiniak fernandes commentedShortened
Comment #16.4
rodrigo panchiniak fernandes commentedImproved readability.
Comment #16.5
rodrigo panchiniak fernandes commentedReplaced "at" by "by"
Comment #16.6
rodrigo panchiniak fernandes commentedAdded git clone link
Comment #16.7
rodrigo panchiniak fernandes commentedAdded link to the sandbox
Comment #16.8
rodrigo panchiniak fernandes commentedAdded mandatory Drupal version mention.
Comment #16.9
rodrigo panchiniak fernandes commentedUpdated first sentence.
Comment #16.10
rodrigo panchiniak fernandes commentedItalicized Vide
Comment #17
anwar_maxReview 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:
1) Please check spelling in the documentation of tefiltro_getfriends() function.
2) Remove unnecessary comments from tefiltro_filtersfilter() fucntion.
Comment #18
patrickd commentednote that many of the issues found are minor and should not be required for approval, therefore please do not insist on having them fixed and do not switch the issue to needs work if there are no major issues found.
Comment #19
cthiebault commentedtefiltro.module
$term_array = array();but then you're using$terms_array[] = $term->tid;.$node_array = array();but then you're using$nodes_array[] = $node->nid;I set status to 'needs work' because if these errors with variable name declaration and access...
Just a detail, change you git clone command in the issue description to
git clone http://git.drupal.org/sandbox/panchiniak/1521136.git tefiltroComment #19.0
cthiebault commentedUpdated: description.
Comment #20
rodrigo panchiniak fernandes commentedThank you cthiebault by the advices.
Git clone command in the issue has been corrected and I will update the code following your instructions in the next few days.
Thanks for all of you generous reviewers.
Comment #20.0
rodrigo panchiniak fernandes commentedgit command corrected
Comment #21
klausiClosing due to lack of activity. Feel free to reopen if you are still working on this application.
Comment #22
rodrigo panchiniak fernandes commentedChanges following the review of cthiebault.
Comment #22.0
rodrigo panchiniak fernandes commentedPDF presentation link added
Comment #23
kartagisHi,
First off, git clone http://git.drupal.org/sandbox/panchiniak/1521136.git tefiltro ends up with a tefiltro directory with a README.txt in it that says "See major version branches". It only works properly if you add --branch 7.x-1.x.
Having said that, below are my comments:
I think you need to spell tefiltro as Tefiltro in tefiltro.info. You should also do that for use in hook_permission implementation in tefiltro.module (so that it wouldn't be the last permission on the permissions page).
You don't need 'type' => MENU_NORMAL_ITEM in hook_menu implementation.
You might be better off renaming tefiltro_form to tefiltro_settings_form for clarification.
Comment #23.0
kartagisUpdated informal presentation link.
Comment #24
rodrigo panchiniak fernandes commentedThank you Kartagis.
The code is already updated according to your review.
Comment #25
kartagisComment #26
jthorson commentedA few comments:
define('TEFILTRO_VERSION', '7.x-1.x-dev');You define a constant here, but it is never used in your code. It should probably be removed. The Drupal.org packaging scripts will add a version line to the tefiltro.info file to help differentiate between versions.
elseif (!db_table_exists('field_data_field_' . $table_name))Use the Field Info API to determine if a field exists. In this case, you likely want to check whether field_info_field($tefiltro_vocabulary) returns a value.
$result_getnodes = $query_getnodes ...function tefiltro_dbgnode($uid) { ...The two queries need to have ->addTag('node_access') added to them, to respect node access permissions on the site. See http://drupal.org/node/310077 for more usage information.
function tefiltro_viewtid($tid, $nid) { ...function tefiltro_getterm($nid) { ...function tefiltro_dbfiltro($nid) { ...The queries in these function should probably be rewritten to leverage EntityFieldQuery ... see http://drupal.org/node/1343708 for usage examples.
->condition('n.type', 'group', '=')Is the node 'type' guaranteed to be 'group'? I think EntityFieldQuery might be more flexible here ... but I'm not certain which version of OG you're developing against, so I'm not certain.
Comment #27
rodrigo panchiniak fernandes commentedThank you jthorson. Repository is now updated according to your review.
Comment #28
kartagisFrom what I read in README.txt, noderefcreate is a dependency; so you should put in in telfitro.info, in dependencies section.
Comment #29
rodrigo panchiniak fernandes commentedThank you for the note, Kartagis. README.txt was not enough clear. The module noderefcreate is only necessary for the example explained there. README.txt is now changed for avoiding this misinterpretation.
Comment #30
rodrigo panchiniak fernandes commentedMissed updating the status in the latter reply.
Comment #31
kartagis1- My first statement on http://drupal.org/node/1522456#comment-7032772 still stands, you should update the default branch from master to 7.x-1.x, or delete master branch.
2- Edit .info file, and replace 'correspondent' with 'corresponding'.
Comment #32
rodrigo panchiniak fernandes commentedThank very much Kartagis,
Project reviewed according to your comments 1 and 2.
Comment #33
rodrigo panchiniak fernandes commentedThank very much Kartagis,
Project reviewed according to your comments 1 and 2.
Comment #34
mpv commentedAutomatic review
You should remove the master branch. I see you already set 7.x-1.x as the default branch, but the master branch still exists.
Manual review
PAReview reports two errors in
tefiltro.module: thebreakstatement in line 28 is unnecessary because it comes after areturnstatement. Also there is an extra line after that break that should be removed. But since there is only one case I think it's better to use an if construct instead of a switch, like this:Note that I also switched to single quotes as they are recommended in the coding standards (also note that I wouldn't bring that up on its own, but since we were on that line...)
You should leave an empty line between functions.
The function
tefiltro_settings_formis not an implementation of hook_form, it's a callback you define for the settings page. You should correct the comment.Comment #35
kscheirerI'm not sure this module needs to exist, sorry. I understand the idea - that you can limit term reference fields to only show options that belong to a user's nodes. But the proper way to handle this is to use a view to display the term reference fields (or any reference field). The view contains the logic you're asking for (only tags applied to my nodes or those of my friends).
Sorry if I'm not understanding the purpose - is there a reason this cannot be done with views?
Comment #36
kscheirerMarking needs work based on previous comment.
----
Top Shelf Modules - Enterprise modules from the community for the community.
Comment #37
PA robot commentedClosing 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.
Comment #37.0
PA robot commentedAdded branch at git clone.