Some actions/ conditions are appearing only after a certain action was added (i.e. #new arguments).
Maybe we should have a page showing all the actions/ condition related to a module, and what arguments need to be present.

Comments

fago’s picture

yep, that makes sense. How would you integrate this in the UI?

amitaibu’s picture

Project: Workflow-ng » Rules
Version: 5.x-2.x-dev » 6.x-1.x-dev
Component: Wng User interface » User interface

Move to Rules

mooffie’s picture

How would you integrate this in the UI?

One possibility is to show the unavailable actions/conditions in the dropdowns, but to use the 'disabled' HTML attribute for them. The browser will gray them out.

There won't be enough room to explain why they're grayed out. So perhaps we could replae the HTML's by some jQuery gadget that provides some more room.

mooffie’s picture

+1

Admins should be aware of all the wealth potentially available for them.

fago’s picture

One possibility is to show the unavailable actions/conditions in the dropdowns, but to use the 'disabled' HTML attribute for them. The browser will gray them out.

Hm, if we do so, the action select is getting more complicated and bigger for nothing. So I don't think that's a good idea to solve this - but thanks for the suggestion. Integrating it, in the "add action" page sounds to make sense though. Perhaps we should add a new page, which lists all actions + their needed arguments + their exposed new variables + their description and link it their, with a text like "Which actions are available?".

Analogous for conditions.

Anyway, I think I've to postpone this, as there are some other more important things (for rules) I've to work on before. So patches are welcome to speed this up...

mooffie’s picture

Status: Active » Needs review
StatusFileSize
new39.73 KB
new37.91 KB

I was off-line so I didn't know, while working on a possible solution, that you consider this to be of low priority.

FWIW, here's a patch that turns the dropdown into radio buttons. So there's now room to show info about hidden actions/conditions. It's possible to turn this feature off via a checkbox in the settings page.

I'm attaching two screenshots.

mooffie’s picture

StatusFileSize
new8.47 KB

...and the patch.

(Remember to clear Drpual's cache, for the theme registry to note the new code.)

amitaibu’s picture

Status: Needs review » Needs work

Patch missing.
From what I see in the screen shots, I like the idea.

amitaibu’s picture

Status: Needs work » Needs review

Cross post - patch is here :)

mooffie’s picture

(I didn't get a chance to make a screenshot of one of these "2 items are hidden" fieldsets open, but they list the unavailbale actions/conditions together with their "unsatisfied" argument(s).)

fago’s picture

Status: Needs review » Needs work

wow, cool.

I like how the additional information is displayed in a collapsed fieldset. However in your solution this great new feature is only available for the radio mode, which might be a bit confusing. I think it would be better to display the information "X items are hidden" just once -> So we could display it also just below the select box.

* In the help text inside of this fieldset, you talk about actions only. Perhaps just improve it to "actions or conditions".

-> As an affect the radios wouldn't be required any more, but indeed they might give a better overview? So I'd be ok with that change and the new setting.

* Perhaps then rename '#rules_all_infos' to '#rules_all_element_info' or better pass the grouped elements as '#rules_grouped_options' (as the unsatisfied arguments would be in a separate theme function then)

* Watch out for checking action/condition names before printing them -> Use check_plain().

fago’s picture

ah and perhaps we should improve the wording of the help text a bit, let me try:

The following items aren't available in this context because they require arguments that are not available in this rule. If you want to use any of these items, you must first add some action that loads a suiting variable of this kind.

Content has type
Needed variable type: Content (-> display the data type here)
...

amitaibu’s picture

Had another idea - maybe we can keep the select list as is, just add a fieldset with the hidden actions/ coditions?

amitaibu’s picture

Assigned: Unassigned » amitaibu

I'll roll a patch soon.

amitaibu’s picture

Status: Needs work » Needs review
StatusFileSize
new38.53 KB
new16.45 KB
new6.6 KB

attached patch inspired by mooffie's work (and screenshots).

fago’s picture

Status: Needs review » Needs work

I like how you solved it, that's great. Also code quality is good, I've just some minor issues:

* about the text "missing arguments" -> in the help text then it's called "not available". I think it should be "Unavailable argument" here to. Furthermore we should use format_plural there again.
* rules_admin_filter_info() return unsatisfied arguments that aren't used any more. This code should be removed.

otherwise it's fine :)

fago’s picture

puh, sry for letting this lie so long.

amitaibu’s picture

Status: Needs work » Needs review
StatusFileSize
new6.85 KB

Rerolled patch with format_plural, however, note that 'unsatisfied arguments' is used
$output .= '<dd><em>'. format_plural(count($items[$group]['unsatisfied arguments'])...

fago’s picture

Status: Needs review » Fixed

thanks. Sry for overlooking the use of the unsatisfied arguments.

I did some further improvements to the strings, now it's called e.g. "28 actions are not configurable" and removed the wording "items" - as rules usually refers to conditions or actions as elements and there is already something like "hidden" condition, which is something different: It's a property for actions/conditions so they are always hidden.

Then I noted that when hidden conditions or actions are available the counting is wrong and fixed that. (e.g. the rule simpletest module adds hidden ones)

-> patch committed, please test. :)

amitaibu’s picture

Was it committed?

fago’s picture

yep, a bit later: http://drupal.org/cvs?commit=161359

sry, I had some troubles with my CVS client

Status: Fixed » Closed (fixed)

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