MyCharts is module that provides platform for any charting engines to be displayed in Drupal in nodes or views. This module comes with Google Charts and Highcharts implementations but is possible to implement any charting engine with not so big effort. Right now, there is no such module that allow to implement almost all properties from chosen charting engine. For example http://drupal.org/project/charts provide also Google Charts and Highcharts but with limited properties, limited charting types etc.
Project page: https://drupal.org/sandbox/maris.abols/1952088
Git repo: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/maris.abols/1952088.git my_charts
cd my_charts
Project is tested and fixed with http://pareview.sh/pareview/httpgitdrupalorgsandboxmarisabols1952088git script, there is only left some WARNINGS I cannot fix because of module specific and also some ERRORS from views plugin files.
Thanks!
Reviews of other projects:
* https://drupal.org/node/2131947#comment-8775725
* https://drupal.org/node/2258419#comment-8776257
* https://drupal.org/node/2267289#comment-8779573
Comments
Comment #1
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxmarisabols1952088git
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
maris.abols commentedComment #3
maris.abols commentedEem, these warnings that automatic tester is giving to me is not possible to fix. I will write some details about them below:
* WARNING | Do not use the raw $form_state['input'], use $form_state['values'] instead where possible - I tested it with $form_state['values'], but it is not contains variables that I need, so this is kind of "Won't fix"
* ".... is not in lowerCamel format, it must not contain underscores" kind of warnings I also cannot fix, because this is view plugins class and these functions are inherited from parent class views_plugin_display(). Please someone let me know, if there is another solution for that.
Comment #4
maris.abols commentedComment #5
maijs commentedInstalled the module on a clean Drupal-7.28 installation and found several things that need to be resolved:
1. Module uses functionality that is provided by the Entity module but Entity module is not listed as a dependency in the .info file.
2. Fatal error is thrown wheh a node of type "Chart" (provided by the module) is viewed: Failed opening required [files]. The page is loaded only halfway because of this.
3. Multiple errors are thrown regarding undefined variables when a node of type "Chart" is viewed.
Comment #6
maris.abols commentedComment #7
maris.abols commentedComment #8
maris.abols commentedComment #9
maris.abols commentedFixed multiple problems:
* Avoided notices(and one fatal error!) in multiple files by adding just simple check if variable exists.
* Edited README file to specify Highcharts engine install.
* Added entity dependency.
Thanks for reviewing!
Ready to review again.
Comment #10
znaeff commentedHi.
Please fix git link in description.
Change
git clone --branch 7.x-1.x git.drupal.org:sandbox/maris.abols/1952088.git
to
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/maris.abols/1952088.git mycharts
Comment #11
klausiThat is not an application blocker, please do a real review of the source code.
Comment #12
heddnComment #13
heddnpages.inc:
theme_mycharts_settings_fields()-- Please don't call drupal_render within a theme function. That way the render array can still be modified in a page alter..info:
Maybe you should sanitize the .info file a little more...
I don't see a dependency on library api module, but there's a call to
libraries_get_path()in several places. And while you are adding a dependency for libraries, don't forget to add a hook_requirements in your .install file.Several places: I think that libraries API will also do the require_once for you, if configured correctly. At the very least, use module_load_include().
form.js:
Invalid number of arguments, expected 2 (at line 33)
Unnecessary semicolon at line 18
mycharts.views.inc
Duplicate array key (at line 30)
forms.inc:
Unused parameter $wrapper_id (at line 157)
Unused parameter $series_count (at line 185)
.module:
The hook_menu seems to be a little broad from a security perspective. What if a node isn't supposed to be viewable? This will allow chart data from it to appear. I've tentatively added PAReview: security tag. At the very least, I feel that more documentation should be provided in the README and/or the project page if open security is the intended functionality. But probably, more attention should be given to the permissions model.
basepluginclass.inc:
http://www.php.net/manual/en/language.oop5.abstract.php
For functions that are really supposed to be implemented by a concrete class, mark the function as abstract and don't return data from them. I'm specifically looking at:
Comment #14
mpdonadioSome of these may be duplicates of #13 above; I had the review 75% done last night before I could finish it up.
Manual Review
1. mycharts.css has rules that may interfere with other themes that are installed (eg, .clear, html.js fieldset).
These need to be properly scoped.
2. In colorpicker.js and form.js, your behaviors aren't using the context that have been provided.
3. In form.js, you probably want to assign the object with the attach property directly, instead of making
an empty object, and then adding the property.
4. You are calling module_load_include from the global context. See https://api.drupal.org/api/drupal/includes!module.inc/function/module_lo...
5. mycharts.basepluginclass.inc has an abstract class, but isn't in the files[] section.
6. mycharts_chart_details_form() has calls to drupal_add_js() and drupal_add_css(). As these are now gone from Drupal 8, you should
really use #attached. See https://drupal.org/node/2169605 This pops up a few other places in the module.
7. mycharts_chart_details_form:42, use field_get_items() instead of directly accessing the data. Since you have a
dependency on the Entity API, you could also use EntityMetadataWrapper. This also occurs in a few different places.
8. In mycharts_chart_details_form() around line 36, you can use field_info_instances() instead of a for-in to get the fields.
9. mycharts_chart_details_form() adds colorpicker.js twice.
10. mycharts_chart_details_form_submit() is using $form_state['input'] instead of $form_state['values']. This data is unfiltered and considered unsafe.
11. I am having trouble totally tracing this out, but it looks like all of the form configuration is being output back
to the form on settings w/o any filtering. For example, _mycharts_form_config:214. Please don't remove the security tag,
we keep that for statistics and to show examples of security problems.
12. Can you use drupal_html_id() instead of mycharts_id_auto()?
13. mycharts.help.inc needs proper docblock w/ parameter and return values for your helper functions.
14. mycharts_buildobject needs proper docblock w/ parameter and return values for your helper functions. Can you
consolidate these two files?
15. _mycharts_load_yaml(), rather than hitting the filesystem each time, you could also use a class_exists() for Spyc
16. theme_mychart(), you can use module_load_include instead of an explicit require_once.
17. mycharts_is_charts_content_type() Use menu_get_object() instead of arg().
18. mycharts_ajax_load_engine_types(). Use drupal_json_output() to render a JSON page request.
ADDENDUM:
19. mycharts_ajax_load_engine_types(). Use drupal_exit() instead of exit() so all of the Drupal request cleanup can be done.
Comment #15
maris.abols commentedComment #16
maris.abols commentedThanks a lot for your reviews, guys!
I made step-by-step fixes, as you said/suggested and after that module still works. :) Also I made quick retest and fix things from http://pareview.sh/ results.
Here is my comments, that I made during rework:
First review(#13):
* Deleted Master Branch - also previously I was on 7.x 1.x branch..
* pages.inc - removed render function/ tested that everything is still working.
* .info - sanitazed file
* libraries - dependency added
* hook_requirements - could not figure out, why I need to check something in this hook in install phase.. Maybe someone can give me a clue?
* require_once in multiple places:
* fixed in "16. theme_mychart(), you can use module_load_include instead of an explicit require_once."
* not sure how to avoid using require_once in external library load, like: require_once $library_path . "/Spyc.php";
* form.js:
* "Invalid number of arguments, expected 2 (at line 33)" - which function it is? I cannot see any error or notice also.
* Removed semicolon at line 18.
* Removed duplicate 'help' element in plugins definition "mycharts.views.inc".
* Removed "Unused parameter $wrapper_id (at line 157)"
* This parameter is passed to the next function where it is used "Unused parameter $series_count (at line 185)"
* Fixed hook_menu permission issues - added new checking to allow only users with 'administer nodes' permission access mycharts.
* basepluginclass.inc - highlighted some abstract classes, not these that were suggested.
Second review(#14):
1. mycharts.css - cleanup and adding parent classes.
2. attached context in colorpicker.js and form.js.
3. Changed behavior definition/
4. Removed module_load_include from global context.
5. Added mycharts.basepluginclass.inc into .info files[] section.
6. Replaces drupal_add_js() and drupal_add_css() with #attached in form.
7. Changed way to load node field values using field_get_items in mycharts_node_charts_after_build() and mycharts_chart_details_form().
8. I left previous way to determine if field type is table field, because using field_info_instances also I need to loop through field
references and check this field type..
9. There are two different colorpicker.js from different locations.
10. Changes form_state['input'] to form_state['values'] in mycharts_chart_details_form_submit(). Also in several other places, but not all.
For example mycharts_chart_details_form() need to use form_state['input'], because form_state['values'] have no form values that I need..
11. Need more info about this on.
12. Changed to drupal_html_id() instead of mycharts_id_auto(). Seems to be working.
13. Added docblock for mycharts.help.inc with detailed descriptions.
14. Added docblock for mycharts_buildobject with detailed descriptions.
15. _mycharts_load_yaml() - using now class_exists('Spyc') to check if Spyc exists.
16. Already fixed in previous steps.
17. I tried to use menu_get_object() instead of arg(), but Drupal then ends with "Fatal error: Maximum function nesting level of '100' reached". Could not find
how to fix this. Instead of that, I just read one more time hoom_menu documentation and add 'access arguments' => array(1). In result of that, I got $node
as first argument of function and I don't need to load it manually.
18. Using drupal_json_output() now in mycharts_ajax_load_engine_types. Also had to add dataType: "html" in data receiving function in JS.
19. drupal_exit() instead of exit() used in mycharts_ajax_load_engine_types() now.
Comment #17
heddnIt isn't a release blocker, but hook_requirements isn't typically done at install but at runtime. See htmlpurifier as an example.
Also, libraries will do the require_once for you. See https://drupal.org/node/1342238, specifically libraries_load(). htmlpurifier has an example of that as well.
However, this is a release blocker:
If someone put nasty xss into a field value, this will simply get printed to the screen. Please run the data through some form of data sanitization. e.g. check_plain if this should be simple text values.
Comment #18
apmsooner commentedYou have pretty thorough documentation in the readme.txt minus the module dependencies. Your project page should have a much better overview and at the very least indicate the dependent modules and libraries ie; Jquery_colorpicker, Tablefield. I would like to see what is required for usage, a more descriptive overview, and screenshots or link to demo.
Comment #19
PA robot commentedClosing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.