My project, upcoming_content provides a ctools content_type pane to easily display nodes that are "upcoming", grouped by the time period the site builder chooses. I could not really find any other similar projects, and it would seem that site builders would need to use multiple views to accomplish the same thing.

Here's a link to my project page: https://drupal.org/sandbox/svaj/2145645
Here's how you can clone my repository: git clone --branch 7.x-1.x http://git.drupal.org/sandbox/svaj/2145645.git upcoming_content

CommentFileSizeAuthor
#34 z.png23.41 KBgisle

Comments

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxsvaj2145645git

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.

svajlenka’s picture

Issue summary: View changes
svajlenka’s picture

Status: Needs work » Needs review

Thanks PA robot! I've fixed those nasty coding standards issues and would like to submit this for review once again!

balagan’s picture

Nice work, looks good to me.

yogeshchaugule8’s picture

  1. The generate view helper function (upcoming_content_gen_view()) in .module file, which defines views object can be moved into separate file.
  2. The Content on line 22 in "upcoming_content_wrapper.tpl.php" file needs little formatting.
  3. You're not using "$opts" variable in "upcoming_content_wrapper.tpl.php" file, please remove if not required.
  4. Also you're setting keys "query" and "content_type" in $opts twice, please remove 1st one if not required.
yogeshchaugule8’s picture

Status: Needs review » Needs work
svajlenka’s picture

Status: Needs work » Needs review

Thanks yogeshchaugule8, I've addressed those issues.

1. That and the upcoming_content_fetch_nodes method now live in includes/upcoming_content.views.inc
2-4. This was cleaned up, thanks for finding some code that didn't need to stick around!

basant’s picture

Assigned: Unassigned » basant
svajlenka’s picture

Assigned: basant » Unassigned

Unassigning, I reached out to basant a few days ago and haven't heard back.

aroq’s picture

upcoming_content.install:
"incase" -> "in case"

upcoming_content_pane.inc, line # 79

'#options' => $ct_options,
this variable can be not defined on this stage, probably you need to define it earlier

svajlenka’s picture

Thanks aroq! Those changes have been made

devd’s picture

Status: Needs review » Needs work

1- Unabe to configure.
2- Unused file upcoming_content.install.
3- Getting the following warning on first installation of this module.
The Date API requires that you set up the site timezone and first day[warning]
of week settings and the date format settings to function correctly.
4- Please tell me how to use this module. I followed your project description but unable to configure or use it.

svajlenka’s picture

Devendra-yadav:

1. There is no configuration except for the panel pane this module provides.
2. Very well, I've removed this file.
3. This notice is from the Date module, you should follow the configuration for that module.
4. My project provides a panel pane, if you do not know how to use the page manager, I'd recommend against using this module. My directions on my project page provide instructions for those who can at least add panes to pages. I've provided a little more detail for those a little unfamiliar with panels, etc.

svajlenka’s picture

Status: Needs work » Needs review
chalk’s picture

@svajlenka,

It's seems to be incorrect and insecure with AJAX. At first of all you should use 'delivery callback' as 'ajax_deliver' for AJAX in hook_menu(). Also add validation for $content_type to prevent error during field instance getting.

It's bad solution to use $_REQUEST['content_type'] in upcoming_content_bundle_fields_callback().

A lot of comments to functions have non-standard spaces before '/*' symbols.

chalk’s picture

Status: Needs review » Needs work
svajlenka’s picture

Status: Needs work » Needs review

Chalk, thanks for the AJAX direction!
I took some time and got all sorts of confused digging into the form api ajax callback stuff. I did learn quite a bit about how Drupal AJAX works :).

I've fixed the usage of $_REQUEST, the comment spacing, the delivery callback setting and added validation on $content_type.

artsakenos’s picture

Hello svajlenka,
the module is quite interesting.
Code is well written, I can't find any evident shortcomings. Here a pair of suggestions:

1) Add the module folder name to the repo clone string, e.g.,
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/svaj/2145645.git upcoming_content

2) Being not familiar with the page manager module, I'm following instructions to install. I read:

* In the page manager ( /admin/structure/pages ), in a page, under content, click "Add Content"

But there, I can only Enable or Edit pages. Editing a page allows me to “add variants” but I don’t see any Add Content or Miscellaneous, to continue the settings. Something I am missing?

a_thakur’s picture

Hi,

Was wondering much of the functionality of the module can be made using views module. Couple of configuration using views we can show *Upcoming Content* based on some filter criteria and create a block of those content and show it on the site.

joachim’s picture

> My project, upcoming_content provides a ctools content_type pane to easily display nodes that are "upcoming", grouped by the time period the site builder chooses

I don't understand what you mean by 'upcoming'.

Also, even if it is accepted that this is an improvement over building a view (which is yet to be shown), it's surely more flexible to expose a block rather than a Panels content pane? That allows site builders to use whatever layout system they want.

svajlenka’s picture

>Editing a page allows me to “add variants” but I don’t see any Add Content or Miscellaneous, to continue the settings. Something I am missing?
Yeah, sorry, you'll need to create a variant if you do not have any.

Regarding as to why this might be used as opposed to views: Not every site builder wants to (or is skillful enough) to create every view for their content. This provides an much easier interface to create a view of content that has a date field that is in the future, grouped by periods of date (week, day, month). Much of the functionality of views could also be made by making extensive use of the database api, but we see views becoming a part of core in 8. This is just another tool to help site builders build with less time spent configuring or coding.

Regarding "upcoming":
Given a content type with a date field, any node whose date field's value is in the future.

Regarding the use of a block over a panel:
A block does not allow for per-instance configuration.

svajlenka’s picture

Issue summary: View changes
gisle’s picture

Automated Review

The automated review of your project by PAReview has found some issues with your code. As coding standards make sure projects are coded in a consistent style we ask you to please have a look at the report and try to fix them. There are all formatting issues that are simple to fix.

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No multiple applications
Yes
No duplication
No. Duplicates trivial use of Views. There may be some utility of having a simple module for admins that don't know how to use Views, but the existence of this overlap must be stated on the project page.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements
3rd party code
Yes: Follows the guidelines for 3rd party code.
Project page
No. Please take a moment to make your project page follow tips for a great project page. In particular, you should add the section "Similar projects and how they are different" and note that it should also be possible to create a list of upcoming events by means of the Views module (re: #19).
README.txt
No: Please take a moment to make your README.txt follow the guidelines for in-project documentation and the README.txt Template.
Also, the folowing line does not make sense: 'In the page manager ( /admin/structure/pages ), in a page, under content, click "Add Content"', and I am unable to follow the rest of the instructions.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Postponed until README.txt is fixed. If "no", list security issues identified.
Coding style & Drupal API usage
My notes so far:
  • (*)Do not place a php statement in the .info-file for Drupal 7 unless they specifically need a higher later version of PHP than is required by core. See Writing module .info files and System requirements.
  • (*) You have several places where you are using php functions directly, and not the Drupal equivalent, eg date() instead of format_date(). This may break localization.
  • There is no hook_help(). It is good coding practice to have this hook for every enabled module.
  • There is a typo un the docblock for hook_menu().

The starred items (*) are fairly big issues and warrant going back to Needs Work. The rest of the comments in the code walkthrough are recommendations.

gisle’s picture

Status: Needs review » Needs work

Setting status.

damienmckenna’s picture

My primary concern is with the AJAX callback. Under normal circumstances only site admins can access the customization interface for Panels, Panelizer or IPE, thus an AJAX callback would only be accessible by someone with access to one of these interfaces. On the other hand, almost every site grants the anonymous user the 'access content' permission, thus any anonymous user (including bots) could access the AJAX callback and potentially trigger a DDOS attack on the site. I recommend adding an access callback and checking for additional permissions.

For people questioning the value of this module, there are many projects where functionality like this is required, where the editorial team want a simple way of selecting multiple content types and a date filter to show content from that time range. While this module could use some improvements, and such improvements should be handled via issues in its queue, I certainly think it fits a niche that Views cannot fill.

gisle’s picture

DamienMcKenna, I haven't looked at the AJAX callback yet. I am postponing any detailed review until the instructions about how to set it up are clear. But if you think there is a security problem, you should tag it with PAReview: security.

Also: I am not questioning the value of the module. I just want the overlap with Views made clear on the project page, so that users know what to expect and also know that there is an alternative.

damienmckenna’s picture

Issue tags: +PAreview: security

@gisle: No problem. FYI I started writing my review before you'd posted the PAReview, so my comment about the module's value being questioned was more towards joachim.

svajlenka’s picture

Status: Needs work » Needs review

gisle and DamienMcKenna: Thanks for reviewing this and providing such thorough feedback!

I've implemented most of the recommendations you two have outlined. However, I am a little curious if by mentioning that a user will need to create a page variant for a page manager page before they content to the variant would be enough. The chaos tool suite's project page doesn't provide much documentation on using page manager to add content panes. If it did I'd gladly point to that to get past this hurdle.

Regarding the ajax callback's permissions. I've set that to 'administer advanced pane settings'. This should limit access to users who have pane configuration permissions.

gisle’s picture

Just a brief note (this is not a review). I subscribe to the security list, and from it, I've learned that the security team is not happy about solutons that allow users with "administer something" permissions to carry out XSS or injection attacks. Allowing unsanitized user input, even from an administrator, is IMHO a blocker.

Why don't you just sanitize it?

svajlenka’s picture

From what I understand the ajax callback for my panel pane's settings form was set to allow anonymous access, which could potentially allow for a DDOS. That has been corrected.
The callback's handling of user input should be fine currently. I'm running an array_key_exists against content type machine names with strtolower'd user input. If its a valid content type, the image & date fields it outputs are run through check_plain / filter_xss_admin. I'm not sure what sanitizing that input would do, as I'm not using it anywhere else other than to verify the content type to get field information on. If I'm misunderstanding this, let me know and I'll be happy to sanitize the heck out of it :)

jojonaloha’s picture

A couple things I notice:

  • You'll want to add a hook_uninstall() in upcoming_content.install to remove your variables
  • In theme/upcoming_content_item.tpl.php I think you want to use url() instead of drupal_get_path_alias()
  • In theme/upcoming_content_item.tpl.php I think this looks strange: $node->node_title, is that because it's coming from Views? I think you also want to use check_plain() when printing that.
  • In theme/upcoming_content_item.tpl.php I think $node->available_date should be the configured date field, just like is done with the image field.
joachim’s picture

> In theme/upcoming_content_item.tpl.php I think you want to use url() instead of drupal_get_path_alias()

That's true. And additionally, you should also call functions in the preprocessor, rather than in the tpl.

> In theme/upcoming_content_item.tpl.php I think this looks strange: $node->node_title, is that because it's coming from Views? I think you also want to use check_plain() when printing that.

Views sanitizes its output. To be certain that this is fine, try making a node with markup that should be escaped in its title.

> upcoming_content_get_image_fields

This returns full field names. But the TPL prepends 'field_' to them. That seems problematic. It's generally a better idea to store the full names of things to avoid confusion. Here there is the extra complication that not all fields have to have the 'field_' prefix!

> * Define the ctools plugin and it's defaults.

Typo. Should be 'its'.

> Regarding the use of a block over a panel:
> A block does not allow for per-instance configuration.

Fair enough. But I suggest you consider Boxes plugins, at least for your future projects. A panel plugin forces your user to use panels on their site.

svajlenka’s picture

Thanks @jojonaloha and @joachim! I've made those changes to the templates, though I'm using l() to generate the link html instead of url(). I've also sorted out the 'field_' issue by refactoring the view that is generated. I also fixed the $node->available_date issue by correctly using the configured time field in the view.

Thanks so much for you input and time!

gisle’s picture

StatusFileSize
new23.41 KB

Automated Review

PAReview came up clean.

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes.

While this module duplicates trivial use of Views, this module have a different target group (those who don't have the skills to configure Views themselves a prefer a ready to-run-module) and solves the problem in a different way. This is adequately explained on the project page.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements
3rd party code/content
Yes: Follows the guidelines for 3rd party code.
README.txt

One of the steps during Configuration:

* In the page manager ( /admin/structure/pages ), in a page's variant, under 
content, click "Add Content"**

I am unable to locate the "Add content" button in a page's variant, see image below.

Screen dump

Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Postponed until README.txt is sorted out.
Coding style & Drupal API usage
My notes:
  • (*) Do not use the package name "Features" in your .info-file. It is reserved for modules that leverages on the Features project. In your case, there should be no package statement in the .info-file. See Module documentation guidelines: Follow package naming conventions.
  • You have at least one place where you are using a PHP function directly, and not the Drupal wrapper. Please see PHP wrappers for more information.
    Example: You use strtolower() instead of drupal_strtolower(). This will not properly lowercase an UTF-8 string. .
  • In upcoming_content_pane.inc you're calling time() to get the current timestamp. Use REQUEST_TIME instead.

The starred item (*) warrants going back to Needs Work. The rest of the comments in the code walkthrough are recommendations.

gisle’s picture

Status: Needs review » Needs work

Updating status.

damienmckenna’s picture

I am unable to locate the "Add content" button in a page's variant, see image below.

You have to first click the gear icon to the top-left of the pane, that will open a drop-down menu that includes "Add content" as one of the items.

damienmckenna’s picture

The "Add content" thing is a basic Panels training issue, I don't think believe it's necessary that this module's README.txt should have to explain how to use Panels, IMHO it should just mention e.g. "A new item will be available under the 'Add content' menu in all Panels-based pages."

gisle’s picture

The "Add content" thing is a basic Panels training issue, I don't think believe it's necessary that this module's README.txt should have to explain how to use Panels

No, but the project page should at least said something like:

"The target audience for this project is experienced Panels users who ..."

If that had been the case, I wouldn't have tried to review it.

I now realize that I am not in the target audience for this project.

I shall to be able to finish my review of this project, so I am taking it off my TODO-list.

svajlenka’s picture

Status: Needs work » Needs review

Hey @gisle and @DamienMcKenna! Thanks again for your time and input.

I've made the recommended changes to upcoming_content. I've also updated the project page to include this statement:

This module is intended for those who are familiar with adding content via Panels.

jojonaloha’s picture

Status: Needs review » Reviewed & tested by the community

It looks like all the recommendations have been fixed, and there haven't been any new recommendations. I think all that was left was a security review.

I looked through the code and don't see any security issues, as well as ran a Secure Code Review through Coder and it only reported minor style issues:

upcoming_content.module

severity: minor review: style_trailing_spacesLine 54: There should be no trailing spaces [style_trailing_spaces]
return '

' . t('Upcoming Content provides configurable panels to easily
severity: minor review: style_trailing_spacesLine 55: There should be no trailing spaces [style_trailing_spaces]
display content about future items. From the IPE or page manager you
severity: minor review: style_trailing_spacesLine 56: There should be no trailing spaces [style_trailing_spaces]
may add an upcoming panel to any page variant. The upcoming content
severity: minor review: style_trailing_spacesLine 57: There should be no trailing spaces [style_trailing_spaces]
panel can be found in the Miscellaneous category when you are adding

Since style issues aren't blockers for full project status, I'm marking this as RTBC.

grendzy’s picture

Issue tags: -PAreview: security

I skimmed the code for security issues, and it looks good to me. The updates to the AJAX command seem to satisfy DamienMcKenna's concerns. Output goes through appropriate Drupal APIs (render, theme, check_plain, filter_xss), and I see that a filter is present to exclude unpublished content.

kscheirer’s picture

Status: Reviewed & tested by the community » Fixed

Checked for security, licensing, Drupal API, and individual account, did not find any problems. Nice work on the security and theming!

Non-blocking issues:

  • You don't need the backticks around drush commands in README.txt
  • You do mention that this module is for those familiar with adding content via panels, consider a stronger statement that indicates this module can only be used with panels, or is a panels add-on. This is just a note, not required at all.
  • In your $plugin defaults, 'uid' => REQUEST_TIME seems like an odd value to use
  • Instead of node_type_get_types() you may be able to use node_type_get_names() instead if that's all you're after

Thanks for your contribution, svajlenka!

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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.