Rules Module extension und perfection (a.k.a. Rules monkey)

Events happening in the community are now at Drupal community events on www.drupal.org.
klausi's picture

Overview

The Rules module is designed to support actions that are executed depending on events and conditions (ECA rules) in Drupal. This proposal is about extending and enhancing Rules module with new features and ideas.

Motivation

Rules is a great contrib module for Drupal and has a wide range of application areas for site builders. It is useful for many use cases and successor of the Workflow-ng module, a very popular piece of software for Drupal 5. The scope of a Google Summer of Code project is ideal to realize some enhancements for the Rules module. The bright future of Rules is not dependent on this SoC, but it will help Rules grow up faster and make it more usable for the Drupal community. I will benefit myself from getting my hands dirty with Rules code and learning from the community.

Description

There are several points to make Rules even more exciting and better to use and interact with:

  • Form support: depending on content of form fields apply rules to change the redirect target, hide fields, restrict access, adjust weights, do validation (maybe integrate with Validation API), insert HTML pre or suffix code. This could be done on events like "form is being built", "form submit" or "form validate". Use case example: Validate that at least one of two form fields has been filled out.
  • Performance: Analyze and rework the inclusion of necessary files (exposed by other modules). Just include needed dependencies as far as determinable for performance reasons. Keep the system slim and fast.
  • Usability enhancements when building actions from events and conditions (also reworking and cleaning up the user interface). Evaluate usage of Advanced Help module to improve user experience. Update the documentation and add a chapter "helping newcomers". Add more documentation for rules sets and scheduling capabilites.
  • Simpletest Framework: It should be easy to write Simpletests for modules providing rules integration. A simplified framework should allow writing short test cases testing the rules integration. Based on the framework write tests for the "Execute PHP-Code" actions and conditions.
  • Improve the rules scheduling system: First off enhance the system to make canceling scheduled tasks possible and provide means to track the execution, e.g. make viewing the rules debug log of scheduled tasks possible. Then add some admin UI to the system. It should list scheduled tasks (maybe by using Views module) and allow admins to manually cancel or re-schedule the tasks. Furthermore admins should be able to manually schedule or just immediately execute Rule sets without any arguments.
  • Make Rules even more awesome! (fulfilling the requirement to use the word "awesome" at least once in this proposal ;-)

Deliverables

  • Patches against the Rules module for every implementation point
  • Documentation on drupal.org

Schedule

Like most other students from Europe I will have to schedule more work in July and August, because our summer holidays start at the end of June. All work will be done in cooperation with the community by using the Rules issue queue.

See the Wiki page for an updated schedule!

Bio

I am a 25 year old student from Vienna, Austria. After school and mandatory military service I started studying computer science at the Vienna University of Technology in 2004. I gained a bachelor degree in "Software & Information Engineering" last year, and I'm now going for a master in "Software Engineering & Internet Computing".

I came to free and open surce software in 2005 when I replaced my proprietary operating system with Ubuntu GNU/Linux. I started to get familiar with the comunities and got in touch with PHP and Python programs. I first met Drupal as a user in 2006, which we use at the students' union homepage (Fachschaft Informatik). I began to administer the page in 2008 and also got a part time job at Pro.Karriere as Drupal software developer. Since then I am involved in the Drupal community (some patches #235109, #226588, #339210) and also attended Drupalcon 2008 in Szeged.

Why I am the perfect monkey for the job

  • I did Drupal development before and I am familiar with the system. As stated above, I know Drupal and its modules (like Rules) for some time now.
  • I am involved in the community. I know the issue queues, I have an account on drupal.org, I am reading the Drupal development mailing list. Sometimes I even join the Drupal IRC channels on freenode.
  • I can become a valuable community member. The Summer of Code project will intensify my relationship to Drupal and my motivation to contribute my skills.

Mentors:

  • Wolfgang Ziegler - Maintainer of the Rules module (and also works/lives near me)

Difficulty: Medium

Wiki page: http://groups.drupal.org/node/21658

Comments

+++

fago's picture

Needless to say that I'm really in favour of this proposal and I'd love to mentor it.

sounds good

Ariesto's picture

I don't have enough experience to help mentor, but I definitely support this project. If you need more ideas for making the rules module "awesome" I'm definitely someone to speak with.

Having said that, I don't know the protocol for an SoC project, but you should be aware that the student app. deadline is April 3rd.

http://socghop.appspot.com/document/show/program/google/gsoc2009/timeline

I've contacted the maintainer of Soc 2009, Alex, to get more details on what projects usually receive SoC approval.

update, typical SoC projects

Ariesto's picture

Alex posted his comments on successful SoC projects here:
http://groups.drupal.org/node/20539

Klausi, I think you've done a good job lining out your project. Let me know if you guys want any more help, especially on improving the UI.

I had a discussion with fago

klausi's picture

I had a discussion with fago today and I've updated the points of the proposal a little bit. I will work out the final proposal after the weekend and submit it to Google. Feel free to add your ideas here, I will take them into account and talk about it with fago.

Thumbs up

narres's picture

I needn't say, that I like rules and rocking

some ideas

Ariesto's picture

Here are a few more improvement ideas:

  1. Cron Rules: add a rule that can either index a single node or trigger the core search to update. This is particularly useful in combination with Views, backlinks argument, because the backlinks only appear if the node had been indexed. A suggested function is: node_update_index(), see this post for more info: http://drupal.org/node/216508

  2. integrate the advanced help module
  3. add a new action: prevent the creation of a node. Have several choices after the prevention: delete the form along with the entered content and re-direct, or idle until some rules criteria is met.
  4. add a new action: convert one node to another node type
  5. add a new action:show a configurable ajax-pop out message to the user
  6. new functionality: some kind of auto-referencing feature, similar to the CCK: nodereference, except it is only created when a criteria of rules is met
  7. change the UI so that it is broken up into Tabs at either the Top of the content region or in a vertical menu. If you are interested, I can provide suggestions of how to separate the UI into these tabs.
  8. @1: Yep, an action "Index

    fago's picture

    @1: Yep, an action "Index content" might make sense.
    @2: I agree that this would be a nice thing to have. I think this falls in the "Usability" point of klausi's proposal.
    @3,4: There is no clean way to do this in drupal, so there won't be support included with rules for it. Changing the node type of an existing node sounds dangerous to me. However of course, modules can expose actions for whatever they want.
    @5: Sounds fine, but rules isn't intended to solve everything on its own.. ;) Instead integrating of an existing popup module might more sense.
    @6: Yep, that's useful and is somehow related to "nodefamily in 5.x". I plan to build something like that nevertheless.
    @7: I'm also interested in UI ideas.. :) Perhaps you could post it to the rules group? Anyway, for rules 1.0 there won't be any major changes any more. (It's time to release!)

    So I think there are quite some ideas. So we need to to identify the most useful ideas and make sure the effort for implementing fits well for a soc project. Any opinions on that?

    I think "simpletest, performance, and usability" are really important points to improve, furthermore I think "forms support" would be very useful.

    oops, 2 more ideas

    Ariesto's picture

    I thought up these two ideas after I logged off:

    8) Integrate Draggable Views. This would be a nifty UI improvement so that actions and rules can be drag-and-drop ordered.

    9) Limited Theme Integration. Sometimes, you just want a block to change color based upon a set of rules criteria. Other modules/theming can get at this, but it still might be a nice add-on to the rules functionality. I would start simple, and only find a way to have rules override the color of a block, plus maybe a space for custom CSS theming (just like the custom PHP option).


    I agree with you Fago that Rules can't do everything. Now that I've listed all of my ideal ideas, I can help sift through and integrate them into the SoC project (provided others find the ideas useful).

    Forms Support would be very useful, since I'm currently struggling to find modules that customize the form process. Form integration would also allow you to add my idea #3, prevent the creation of a node, because you could create a custom, fake submit button that is controlled by the Rules module instead of trying to Hijack Drupal core.

    I'll post my suggested UI plan of attack, later today or tomorrow.

    Proposal updated and submitted

    klausi's picture

    I reworked and extended the proposal and submitted it to the official Google queue. Thanks for your comments, fago and I tried to incorporate some ideas.

    Just saw this new module. It

    amitaibu's picture

    Just saw this new module. It seems something similar in concept to the FAPI integration - http://drupal.org/project/formadjust

    interesting

    fago's picture

    thanks for the pointer!

    The module seems to support changing of form element attributes directly. There isn't any support for validation or submit or it doesn't look like there is an ability to define arbitrary conditions - it just works upon user roles. As well as there is no abstraction for "actions", so users have to know the form properties. So I don't think it's overlapping with the rules integration, but of course it's worth a look, maybe some ideas of it are useful for the project!

    Support for looping and data

    mitchell's picture

    Support for looping and data lists and additional work on foreign ui's, such as Provide example foreign UI: comment notifications and other examples, would both be amazing steps toward Rules perfection.

    Hooray, this proposal was

    klausi's picture

    Hooray, this proposal was accepted!

    That is great news!

    Ariesto's picture

    That is great news! Gratz. Keep us updated. Will you be working on the SoC 2009 google site or in a Drupal area?

    PHP 4 Support

    tannerg's picture

    Congratulations on your project being accepted to SoC.

    I have a humble request.

    The rules module does not currently support PHP4. It has a critical bug when checking for nodes of content type before performing an action. In this scenario, the condition is always evaluated to be false.

    I know the number of environments running PHP4 are dwindling, but some of us are still stuck supporting it and would really benefit from an update of this module to support PHP4.

    I would be happy to test any fixes in my PHP4 environment if that helps with the process.

    Thanks!

    Uh, no!

    alex ua's picture

    First of all, this is not the Rules module issue queue, which is where this type of requests belong. Second of all, support requests are not part of the SoC. Third of all, the student already has a proposal, one which was accepted, and as far as I can tell none of it has to do with making Rules work with PHP4 (actually, I'd guess that the proposal would not have been accepted if the student proposed to do this).

    PHP 4 is DEPRECATED- so my advice is get a real host that doesn't require you to use unsupported software.

    --
    Alex Urevick-Ackelsberg
    ZivTech: Illuminating Technology

    Alex Urevick-Ackelsberg
    ZivTech: Illuminating Technology

    Perfect?

    tannerg's picture

    I thought "perfecting" the module might include making it compatible with PHP4 which according to the Drupal requirements page is still supported in D6

    http://drupal.org/requirements

    My not so real host is a University client who simply moves very slowly when it comes to upgrading systems so just switching hosts is not always an option.

    Don't worry, I'll stay out of these groups from now on for fear of further flaming.

    Everything has a place...

    alex ua's picture

    mediamob- I'm sorry if you take my post as a "flaming", but IMO it is rude to try and interject your support request into a SoC project. In fact, I don't see where it's stated that Rules doesn't support PHP4. Either way, this is not the appropriate place for this discussion...

    --
    Alex Urevick-Ackelsberg
    ZivTech: Illuminating Technology

    Alex Urevick-Ackelsberg
    ZivTech: Illuminating Technology

    I would also suggest that

    gordon's picture

    I would also suggest that the .info file has the line php = 5.x so that it can only be enabled on a server with php 5.x

    --
    Gordon Heydon

    --
    Gordon Heydon

    Rules

    Group organizers

    Group categories

    Categories

    Group notifications

    This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

    Hot content this week