I've taken an initial pass at a Drupal 7 port for faq, which passes coder tests and has a working node form, but not much more. Attached is a patch against the latest D6, which I hope provides a useful basis for a D7 branch.
| Comment | File | Size | Author |
|---|---|---|---|
| #33 | faq_styling.png | 45.89 KB | boftx |
| #18 | faq-762152-2.patch | 22.02 KB | mikejoconnor |
| #17 | faq-762152.patch | 21.14 KB | mikejoconnor |
| #12 | faq-762152.patch | 19.96 KB | willvincent |
| d7.patch | 73.36 KB | sreynen |
Comments
Comment #1
sreynen commentedChanging status.
Comment #2
stella commentedOooh, thanks! will review soon.
Comment #3
stenjo commentedI'm checking this out at the moment (Working on a D7 version of FAQ_Ask and need this).
Seems like D7 does not like
drupal_install_schema('faq');at line 47 in faq.install. D7 installs the tables if hook_schema() is defined.Ref http://api.drupal.org/api/function/hook_install/7
In addition, the check_markup() has changed in D7 and expects other parameters.
$node->detailed_question = check_markup($node->detailed_question, $node->format, FALSE);line 389, faq.moduleChanged to
$node->detailed_question = check_markup($node->detailed_question);Ref. http://api.drupal.org/api/function/check_markup/7
hook_view has also changed (http://api.drupal.org/api/function/hook_view/7)
Comment #4
rorymadden commentedSubscribing. Has any progress been made on this yet?
Comment #5
BenK commentedSubscribing...
Comment #6
bfsworks commentedTrying to install FAQ_Ask which had a D7 port but is dependent on this module. Any testing, patches, or updates?
Comment #7
vikingew commentedI see that work has started be commit into CVS, can it also be hooked up to have dev releases pushed out, please? Hide it if feel need to but make it available under all releases.
Comment #8
mxtI need this fantastic module for Drupal 7 too.
Hope to see a dev 7 version soon...
Thank you very much for your work!
MXT
Comment #9
deminyI wish that the D7 version will come out soon. Thanks
Comment #10
stenjo commented@MXT @deminy, I have a feeling the chances for a D7 version of this module increases somewhat if you are able to offer some form of help in moving the code to an updated version. I think any help would be valuable - even if all you can do is testing it...
Comment #11
drupa11y commentedI could offer help in testing, html & css.
Comment #12
willvincent commentedHere's a patch against the D7 version in cvs. (NOT the 6.x-1.x-dev version!)
This should address a couple minor issues with JS & the filter format setting in the admin include file.
Edit: attachment link doesn't seem to be working right.. http://drupal.org/files/issues/faq-762152.patch
Comment #13
drupa11y commentedI would like to test it but I don´t understand how to check out the branch with cvs on os x, sorry.
Can anyone provide a cvs-command to copy and some short instructions or is there a gui-client and a tutorial somewhere?
Thanks!!!
Comment #14
BenK commented@mori: Follow the instructions here: http://drupal.org/project/faq/cvs-instructions
Just choose from the dropdown the version you want to check out (6.x-1.x-dev).
Then just cut and paste the command into the Terminal program on Mac OSX.
--Ben
Comment #15
drupa11y commentedThank you!
Comment #16
Tilt_11 commentedSubscribing...Any chance you would consider including the functionality of faq_search (no longer maintained) in faq-7.x?
Comment #17
mikejoconnor commentedHere's an updated patch. I removed some dpm' and added the following.
I haven't tested all of it, we will be doing that over the next couple days.
Comment #18
mikejoconnor commentedHere's an update to patch #17, which adds the following items to hook_filter_info()
Comment #19
jamesoakleysubscribe
Comment #20
drupa11y commentedThe try to ad a faq (/node/add/faq) fails with the D7 v1.0 release:
Fatal error: Call to undefined function node_body_field() in /Applications/MAMP/htdocs/drupal-7.0/sites/mori.d7.dev/modules/content/faq/faq.module on line 251
Also I could not use "admin/config/faq":
Fatal error: Call to undefined function filter_form() in /Applications/MAMP/htdocs/drupal-7.0/sites/mori.d7.dev/modules/content/faq/faq.admin.inc on line 47
The 2 patches from above did not help to this issues.
FAQ was latest cvs checkout.
Got also an error with the 2nd patch:
mori-mbp-17:faq mori$ patch < faq-762152-2.patch
patching file faq.admin.inc
Reversed (or previously applied) patch detected! Assume -R? [n] y
patching file faq.js
Reversed (or previously applied) patch detected! Assume -R? [n] y
patching file faq.module
Reversed (or previously applied) patch detected! Assume -R? [n] y
Hunk #3 FAILED at 1542.
1 out of 3 hunks FAILED -- saving rejects to file faq.module.rej
mori-mbp-17:faq mori$
Comment #21
drupa11y commented***************
*** 1539,1558 ****
*/
function faq_filter_info() {
$filters['faq_embed'] = array(
- 'title' => t('Embed FAQ page'),
- 'cache' => FALSE,
'description' => t('Embed FAQ page using [faq] type tags. Disables filter caching so not recommended for all input formats.'),
'tips callback' => 'faq_filter_tips_faq_embed',
'process callback' => '_faq_filter_process',
- 'settings callback' => '_faq_filter_settings',
);
return $filters;
}
- function _faq_filter_settings($form, &$form_state, $filter, $format, $defaults, $filters) {
- return array();
- }
-
function _faq_filter_process($text) {
$text = preg_replace_callback('/\[faq:?([^\]]*)\]/', '_faq_faq_page_filter_replacer', $text);
// Remove comments, as they're not supported by all input formats.
--- 1542,1556 ----
*/
function faq_filter_info() {
$filters['faq_embed'] = array(
+ 'name' => t('Embed FAQ page'),
+ 'no cache' => TRUE,
'description' => t('Embed FAQ page using [faq] type tags. Disables filter caching so not recommended for all input formats.'),
'tips callback' => 'faq_filter_tips_faq_embed',
'process callback' => '_faq_filter_process',
);
return $filters;
}
function _faq_filter_process($text) {
$text = preg_replace_callback('/\[faq:?([^\]]*)\]/', '_faq_faq_page_filter_replacer', $text);
// Remove comments, as they're not supported by all input formats.
Comment #22
stella commentedThese patches and other changes have been committed. Testers needed though, so please download today's dev version and see if it all works as you expect - especially the categorised listings.
Comment #23
boftx commentedsubscribe
Comment #24
boftx commentedI downloaded the dev file available at 21:30 PST and found the following (this is not a complete test but should be a start.)
Install and enable went smooth, that's encouraging. :)
Basic config went pretty much as expected.
In the permissions block the permisson "Edit own FAQ nodes" shows up twice. I presume one of those was meant to be "Edit ALL FAQ nodes"
The problems started when I tried to categorize questions. Tests were performed with a single question and a single term under the manually created vocabulary "FAQ"
Basically, once I created the vocab, I started seeing the following error message with categorze questions disabled but with the vocab included in the config list.
"Notice: Undefined offset: 3 in faq_page() (line 552 of /sites/all/modules/faq/faq.module)."
When I enable the categorize questions I started to see this error every time I went to the /faq link.
"Fatal error: Call to undefined function taxonomy_term_count_nodes() in /sites/all/modules/faq/faq.module on line 575"
I added a new field to the FAQ content type to pull in the FAQ vocab, and made it optional. After editing the existing question at the node level I continued to see the fatal error above.
Disabling categorize questions removed the fatal error, as did excluding FAQ on the config page. However, excluding the FAQ vocab with categorize enabled resulted in no question being listed.
Could this be related to the fact that there is no option to display uncategorized questions such as was present in the D6 version?
Comment #25
boftx commentedFurther info. Choosing the option to NOT show category labels, with categorize enabled, does NOT produce the fatal error. Also, the question appears whether it has been assigned a term or not.
I may be testing a pathological border case, so I will test further with more than one question and more than one category.
Also, I found it VERY tedious to set up the categories, having had to create a vocab, and then excluding all but that one, and also having to add a custom taxinomy field to the content type. I guess this is a result of changes to the D7 core, but it sucks just the same. This implies that the module should create the Taxinomy vocab with one default term ("General"?) and the CCK field for it already installed in the content type.
I would also suggest having the config automatically choose the FAQ vocab for its source and offer the option to add/change to other vocabs similar to what the D6 version did.
Edit: Testing with multiple categories and multiple questions does not change the problem. but it does point up the CSS issue described below.
Comment #26
boftx commentedMore info.
Having categories enabled produces the following fatal error when clicking on "Order":
"Fatal error: Call to undefined function taxonomy_term_count_nodes() in /sites/all/modules/faq/faq.admin.inc on line 370"
Comment #27
boftx commentedOne little styling issue. The div class "
<div class="faq-question-answer faq-viewed" style="clear: both;">" needs the clear both property to prevent the next question from bumping up against the category name when using the answer displays under the question inline option, especially with the accordian effect.That's simple enough to fix in the style sheet, but should be done by the module if possible.
Comment #28
boftx commentedWith regards to the fatal errors I encountered, I found the following discussion concerning this very issue as a bug report:
Re-add taxonomy_term_count_nodes() (http://drupal.org/node/602240)
In short, unless you want to roll your own your screwed. I am not familiar with the new D7 design philosophy so I can't say what the proper approach to dealing with this (apparently common) problem is.
Comment #29
boftx commentedWell, for what it is worth, I dug into making categories work and found a ..... mess.
The short version is that the table taxonomy_term_node does not exist, instead the table taxonomy_index should be used. Worse yet, the vid column does not exist in the new table, so several join conditions failed.
I ripped the missing functions from the D6 Taxonomy module and added them to the bottom of faq.module. The queries had to be converted to the D7 dynamic queries because the call to db_rewrite_sql() no longer exists, either.
Plus, the code "while ($term = db_fetch_object($result)) {" had to be replace by "foreach ($result as $term) {"
Some of you might have gathered by now that PHP is not my native language, I'm a perl programmer by trade specializing in e-commerce, so all of this is very strange to me.
Here is the code that I ripped and changed, other changes were changing the table name and removing the vid conditional. It isn't a total fix, but it clears up a lot of the problem. On the other hand, I am now seeing theme error msgs on occasion. I've gone as far as I going to get tonight.
Hope this helps a little.
Comment #30
boftx commentedChanging priority and status given the severity and complexity of making categories work correctly. This thread has now gone far beyond the original request and in my opinion should be moved to the 7.x-1.x-dev version.
I should note that I think this is a GREAT module under D6 and I would be hard-pressed to even consider D7 without it. Helping to find fixes to problems like this is the least I can do to say thank you.
Comment #31
stella commentedI fixed the naming of the "Edit all FAQ nodes" permission and the call to taxonomy_term_count_nodes(). There is a simple replacement function called faq_taxonomy_term_count_nodes() but unfortunately it doesn't count nodes associated with child terms. A longer term solution will need to be found for this, but for now this will do until the rest of the module stabilises.
I haven't been able to reproduce this issue so far, but it's possible that you were using an older snapshot as the taxonomy_term_count_nodes() issue was fixed yesterday but yet still appeared for you. If it's still happening, can you send me the details of your faq config, particularly the admin/config/content/faq/categories page.
That is by design. You would need to disable the "Categorize questions" option in order to see uncategorized questions.
I can't reproduce this issue. If it's still a problem, please provide more details on your faq configuration.
Hmmm, it is more hassle in D7. However, I'm not sure that the FAQ module providing a taxonomy vocab field will help as a lot of sites don't want to categorize their faqs.
Pretty sure the D6 version doesn't do that...
I can't reproduce this either. Perhaps provide a screenshot? What theme are you using?
I also fixed some other issues, including a theme function call.
Comment #32
stella commentedComment #33
boftx commentedWith regard to this statement:
Is there any reason to not provide a default vocab named FAQ? The site admin could then decide whether to use it or not. I don't think it would interfere with non-categorized operation and saves a small headache (and maybe a little confusion) for those who do want to use it. The hassle of creating a CCK field for the FAQ content type can then be dealt with in the documentation if nothing else.
In the meantime, I'll grab the latest snapshot and see what happens. I know that what I did was very ugly.
As for the styling issue, I am using the Danland theme. I am attaching a screenshot of what I saw.
Comment #34
boftx commentedThe snapshot available at 21:30 PST seems to have fixed the SQL and table name errors I experienced earlier in faq.module.
However, if you click on "Order", select a category, then click on "Search" you will still get the same kind of error relating to the wrong table name, and I presume the missing join column. Here is the error message I received:
Comment #35
boftx commentedRegarding this comment:
I would suggest that any uncategorized questions be shown for users with admin permission in a seperate group.
Granted, in a default install, this could be addressed by making the category tag required in the content type, but I don't know what issues this would present for the faq_ask module (which is a very handy module.) Without something like this, it seems that an admin would not have an easy way to know that there are questions that are not being shown.
I had confused the action of the Weblink module with FAQ in this regard. That module has an option to display uncategorized items in a seperate group named "Uncategorized".
Comment #36
boftx commentedJust test the latest build available on 2011-01-11 at 09:45.
Was able to click on Order, then Search without a problem. However, no entries were displayed even though they existed for that category.
When I clicked on the "List" tab I received this error message: (all paths are from the drupal install root.)
Comment #37
stella commented@boftx - can you try clearing your Drupal cache?
Comment #38
boftx commentedClearing all caches in the admin area cleared both problems. I didn't think to do that since I don't have any cache configured, but it seems there is some going on anyway. Thanks for the tip!
New behaviour observed. After clicking on order, and selecting a category, all questions are displayed no matter what category they are in. Reordering does not take effect when going back to the list view, but does not move the questions out of the assigned category. This was tested with two questions in each of two categories. Testing with just a single question in each category, while displaying the all questions shown bug, does not demonstrate the re-order being ignored problem correctly.
Comment #39
boftx commentedRegarding the styling issue previously mentioned, the class tag "clearfix" should be added to any "faq-question-answer" div.
Comment #40
stella commentedI can't reproduce the styling problem you've described with the Bartik core theme, so I'm inclined to think that it is a problem with the Danland theme or some other module's css.
This would be new functionality (not present in D6 version) and this ticket is purely for the D7 port and so a separate ticket should be opened, though I remain to be convinced.
Not really an option as a lot of users don't want to categorize their faqs.
I've also fixed the ordering of categorised faqs.
Comment #41
boftx commentedEven though the styling issue might be a problem with the Danland theme itself (which I haven't had time to test against other themes) the fix is so simple, merely adding the "clearfix" class tag to the div, that I see little reason not to do so.
I understand that part of what I am addressing when it comes to categories is a result of what I would call major changes to the Taxonomy module and Drupal core. Be that as it may, I believe that making things easier for the admin is a Good Thing (tm) overall. That is my main argument in support of showing un-categorized questions for those with admin permissions. This particular functionality is not critical at this point in time, but should not be forgotten.
Edit: I just tested the Kanji and Basic themes and they don't show the styling issue, and I confirmed that Bartik doesn't either. So it would appear that it is a Danland related issue. That said, I would still suggest adding the "clearfix" tag just so that others don't run into the same thing as a defensive measure.
Comment #42
stella commentedI won't add theme specific fixes to the module. You should be able to fix it the theme layer though.
Comment #43
boftx commentedOrdering problem appears to be fixed. I'll test with other categroy group/question display options to see what happens.
Looking forward to the real release for this module being soon.
Comment #44
boftx commentedFor those who might run into a mis-behaving theme as I apparently have, here is the fix. I put the following into the theme's local.css file:
Kudos to stella for having very good (comprehensive) divs and class names to begin with, it makes this kind of customization trivial. I should add that after thinking about it some more I agree that putting any changes like this in a local theme file is the correct solution instead of adding another class tag in the module that depends upon a specific D7 css definition.
Comment #45
bryancasler commentedsubscribe
Comment #46
pbuyle commentedsubscribe
Comment #47
pbuyle commentedSee #1043572: FAQ node access doesn't return expected values.
Comment #48
sreynen commentedThis issue is now being used as a catch-all for any problem with the D7 port. These problems should each have their own issue so the discussions can remain focused. I'm marking this as "fixed" (we have a D7 port) and suggest remaining problems here be opened as separate issues against the D7 version.