A new request for dynamic views forms has come my way and a quick search lead me to this project which seems perfect. There hasn't been a update made for around 6 months so I was just wondering whether this project is still under development?

Also is there any working examples of this?

Thanks

Comments

dagmar’s picture

Well, the project is not being maintained at this moment, however it is not abandoned. This module requires views 3 which is not currently enough stable.

I'm working in other projects that doesn't requires this modules and therefore I didn't continued working on this project this year. But there are plans to continue with this module this year, maybe at the middle of 2011. I don't know.

I would like to get some feedback of how this module works with the last dev versions of views 3, my last test was 3 months ago, and probably it is not working fine now.

Related to working examples, I'm afraid this is not possible, Advanced Exposed Filters is oriented to complex administrative interfaces and administrators usually restrict the access to this kind of views.

drclaw’s picture

StatusFileSize
new20.44 KB

I just installed this last week on the Alpha3 version of Views 3. The following was broken:

- The reset button was not displaying
- The image for removing filters (the red 'X') was not being loaded properly
- When trying to remove filters, a page reload was running and repeating the last applied filter rather than deleting the selected filter.
- Collapsible fieldsets were not collapsible (needed collapse.js added in the template file)

I fixed all these issues and got it working. I also added a couple fun things:

- Javascript to choose which filter to apply from a drop down (needed this because we have 20+ exposed filters on our view) Feels a bit hacky but works well.
- Fixed the output of method process_value() to accomodate for dates (only displays the dates appropriate for the operator now)

I've attached a patch if you want to take a look. Some of it may seem a bit hacky, but it got it working quite well.

This is a pretty awesome module. It's been really helpful for us so far. I'm working on something to save a set of applied exposed filters as well. I'm thinking if you can save a serialized copy of what's in $_SESSION['aef'], you can re-apply the filters very easily by just loading it in init(). Thoughts?

johnichiban’s picture

This patch worked for me. (other than the extra line feeds at the end)

Any idea how to combine this module with one of the csv/excel export modules? I'd like to build a reporting interface with this module that allows the end user to export results of the query as a spreadsheet. None of the export modules I've tried (Data Export, Views Bonus Pack, etc) seem to be able to coexist with this module... the exported results seem to ignore the filter settings.

Any thoughts?

drclaw’s picture

It's funny you mentioned this because I was just about to do this on my site anyway. =P

I tested this with the views bonus pack and got it to export as a CSV and an Excel file. Here are the steps i took:

  • Download and install the Views Bonus Pack Module (I'm assuming you have it already but just in case)
  • Create a view and add all the fields and exposed filters you want to the default display (this is just so future displays we create will inherit these fields and filters)
  • Change the Exposed form style: to Dynamic exposed filters
  • Create a new 'page' display and give it a path
  • Create a 'feed' display in your view that has all the same fields and exposed filters as your page view (should be true if you added them to the default display)
  • In 'Style Settings" Choose the style: 'CSV file' or 'XLS file'
  • In the configuration section for the new style we've chosen check the 'Provide as File' box and specify a filename
  • Give your feed a "path"
  • Just below the path, change the "Attach to:" property to your 'page' display
  • Save everything and go to the path defined on the 'page' display
  • There should be a 'csv' or 'xls' button at the bottom of the view. If you filter how you like and click the link, it should prompt you for a download which should be filtered the same way as your view.

I think the key is to make sure that all your displays uses the Exposed form style: Dynamic exposed filters and that they all have the same exposed filters available. I think you could probably change which 'fields' are visible in your feed, however, and get away with it.

Hope this helps!

johnichiban’s picture

Thanks! This is pretty close to working. It appears to work initially, but there are some serious bugs in the attached view (the CSV feed). In particular, when multiple filters are added or deleted, the attached view can get out of sync. The main page view will display the proper output, but the attached CSV view will lose the filter settings, or keep old filter settings. The behavior is pretty erratic, but it seems to happen consistently for me if I delete a filter.

Do you see similar behavior after deleting filters? I've noticed this in particular when I add multiple filters using the same field. For example, add filters for "Name = Bob" and "Name = Alice" (grouped by OR). Then delete one of the filters. The page output looks fine, but the CSV output is no longer right.

johnichiban’s picture

I did some further poking around, and adding multiple instances of the same filter does seem to be causing a problem. The main view itself has no problem interpreting the filters, the results look exactly as would be expected.

I'm guessing the issue is related to the use of references like "$form_state['values']['aef_selected_filter']" in the form submit function or elsewhere. I suspect that both instances of the filter have the same value of "aef_selected_filter" (the field name) and when the module iterates through the array of filters it misses all but the first instance.

drclaw’s picture

I see... I think I know what the problem is here... Basically AEF is using it's own method for filtering the view that is different than the exposed filter method. The basic exposed filters passes information around using the query string (e.g. www.example.com/myview?my_field_nid=11) but AEF stores all the filter information in the $_SESSION variable. In fact, I think you can even delete everything from the '?' and on and the filters still apply if you're using aef (although I could be wrong about that one...) AEF does, however, still put *some* filter information in the query string, which is why it seemed like the xls and cvs export was working for me (my filtering was very simple).

Anyway, the question is... what do we do now? I know for a fact that the basic exposed filters don't natively handle multiple instances of the same filter, but it seems like all the modules that export data from views as xls or csv all use the same feed/attach method which relies on it. I think building something that spits out a csv from aef might not be too hard, but I'd prefer to have a solution that works with existing views data export modules... Any thoughts?

Any thoughts from the module maintainer? =)

dagmar’s picture

What AEF basically does is:

  1. Collects all the non exposed filters
  2. Removes all the applied filters (event the non exposed)
  3. And applies again the non exposed filters first and the saved into the $_SESSION variable

I really have to review how this is working, there have been almost a year since my last commit and now I have a better understanding of how views works.

Sadly as I said in #1, I don't have much time to work in this project currently, but I can review "smaller" patches than provided in #2.

@drclaw thanks for the patch, but I'm afraid cannot commit it as is, it seems fix a series of different bugs, and I would like to see at least two or three new issues to discuss them one by one.

drclaw’s picture

@dagmar - thanks for the reply. Good rundown of how AEF works. That's what I gathered from tinkering around with it. I think it's a good approach for now, but I'm not exactly a views expert. =P

No problem about the patch, I understand. When I have some time, I'll try and re output the patches individually and create some issues that you can get to when you have time.

I'm going to keep using this module so I'll post patches as I go along and you can take 'em if you like 'em. I know you're busy with other stuff, but if you have any ideas about outputting aef filtered data to csv or xls (preferably leveraging views bonus pack), I'd love to hear it!

drclaw’s picture

StatusFileSize
new45.72 KB

@dagmar I just wanted to post this one big patch for AEF with all the changes I've been working on. I know that it's pretty much the exact opposite of what you requested (small patches for individual features, that is) but I just haven't had the time to individualize the patches. Also, some of the features are not so loosely coupled, so It's hard to separate them. In any case, I just thought I would get this patch up here in case anyone who comes across this module needs some of the added functionality. Also I thought maybe if you had a chance, you could apply the patch and at least try out the new features to see if you like the direction I'm taking. If you do, maybe somewhere down the line we could talk about what I did to achieve them and see if that jives with your methodologies. If you don't like it, then it can just live in patch form and I'll keep just using it for my own purposes. =)

This patch is meant to be used on the current (Jan 26, 2011) dev release on the project page. It should be used INSTEAD of the patch posed earlier in comment #2 as it includes the changes made in that patch as well as additional changes. The main things this patch will add/change:

  • Everything in Comment #2
  • Saving, Loading Filter Sets (also a Manage Saved Filter Sets admin page)**
  • Very simple CSV exporter ( @johnichiban: thinking of you... =P )

** NOTE: The Saving and Loading Filter Sets functionality requires an uninstall and re-install of the module. I guess I could have included an update() function, but since there was no database information prior to this feature, I didn't really think it was necessary. Uninstalling and re-installing the module won't affect any views using it.

drclaw’s picture

Status: Active » Needs review
dawehner’s picture

Status: Needs review » Needs work

You simply can't review such a damn big change. That's just my personal oppinion.

+++ aef-dynamic.tpl.php	2011-01-17 14:03:21.000000000 -0800
@@ -13,70 +13,140 @@
+    <select name="choose_filter" class="form-select" id="choose-filter">
+      <option value="choose">&#60choose...&#62</option>
+      <?php if ($user_can_save_filters): ?>
+        <option value="load_saved_filter">&#60Load Saved Filter Set...&#62</option>
+      <?php endif; ?>
+      <?php foreach($filter_options as $id => $label): ?>
+        <option value="<?php print $id ?>"><?php print $label ?></option>
+      <?php endforeach; ?>
+    </select>
+    <?php if ($user_can_save_filters): ?>
+      <a href="/admin/settings/aef_manage_saved_filter_sets" class="manage_saved_fitlers">Manage Saved Filter Sets</a>
+    <?php endif; ?>

Not using fapi/making things not translatable is a nogo

drclaw’s picture

Yes. I'm embarrassed about this patch. I was young and impetuous! I kept meaning to fix it, but was so busy last year. I guess I just thought I'd share it in case anyone wanted to give it a try... or something... =)