View Full Version : Simple FAQ Module
Hi,
because I needed one, I wrote a simple FAQ module for dotProject. It is a bit of a quick hack, but at least it satisfies my needs. Each FAQ entry consists of a question, an answer and a category (added a new select list to the System Lookup Values). Each FAQ can be connected to one or more projects, but does not need to be connected to any project at all. I also created the English and German language files for the FAQ module. The FAQs for each project are also shown in a tab when viewing a project.
To get a bit of layout into the FAQ entries I am using PEAR::Text_Wiki with the Mediawiki renderer. To get this working, I added the PEAR packages to the /lib/PEAR/ directory and also had to add the basic PEAR.php file, because PEAR::Text_Wiki depends on it. I even added a quick markup help for the wiki markup.
Just download the attached zip file at the link below and unpack it in your dotProject directory. Then open "System Admin > View modules" and activate it. That should be basically it.
http://sourceforge.net/tracker/index.php?func=detail&aid=1527368&group_id=21656&atid=372485
Have fun with it. If you have any questions this thread is the right place for it.
Best Regards,
Ralf
heliocentric
27-07-06, 03:15 PM
Hi Ralf,
Nice and simple - thanks for your contribution! One small thing I noticed is the faq tab does not have an option to add a new FAQ.
This means you need to make the FAQ module visible in the main menu to add a new FAQ (in the event that a Project dopes not already have an FAQ listed that allows you to navigate there in a round about kinda way) - something that is not always wanted...
Cheers,
Heliocentric.
Hi Heliocentric,
I am trying to set the module up in the sourceforge dotmods project. So for now I can only send you the code to add manually.
In /modules/projects/view.php you need to search for the following lines:
$titleBlock->addCell();
$titleBlock->addCell(
'<input type="submit" class="button" value="'.$AppUI->_('new file').'">', '',
'<form action="?m=files&a=addedit&project_id=' . $project_id . '" method="post">', '</form>'
);
Then add this lines below to add a "new FAQ" button:
$titleBlock->addCell();
$titleBlock->addCell(
'<input type="submit" class="button" value="'.$AppUI->_('new FAQ').'">', '',
'<form action="?m=faq&a=addedit&project_id=' . $project_id . '" method="post">', '</form>'
);
Next you need to open /modules/faq/addedit.php and search for these lines:
else
{
$project_list = array();
}
and add these lines before them so it will look like:
elseif ($project_id > 0)
{
$project_list = array();
$project_list[] = $project_id;
}
else
{
$project_list = array();
}
Now you will have a "New FAQ" button in your project view and the project will be selected. After saving the new FAQ you will be redirected back to the project view.
HTH,
Ralf
heliocentric
31-07-06, 10:35 AM
Excellent thanks!!! :D :D
janpirate
19-08-06, 05:49 PM
greetings,
i got an error message when click to configure FAQ module
"Missing file. Possible Module "faq" missing! "
:(
When I click the link to open a FAQ I get this error:
Fatal error: Cannot use object of type CFaq as array
in /mypath/---CMS---/dotproject/modules/faq/view.php on line 113.
I've made the changes like the post above.
zeheeba
20-10-06, 07:52 AM
I have this same Problem.
"Fatal error: Cannot use object of type CFaq as array in /var/www/pm/dotproject/modules/faq/view.php on line 113"
This is shown when trying to open a FAQ. It appears it has to do with the date set line at 113.
$faq_date = new CDate( $row['faq_date'] );
CFaq is defined when creating an array I think:
$row = new CFaq();
Anyone have any clue how to fix this? I know that if you delete the line in question and this section starting around 140 you can open a FAQ, but not get a date.
<tr>
<td align="right" valign="top"><?php echo $AppUI->_('Date');?>: </td>
<td><?php echo $faq_date->format( "$df $tf" ); ?></td>
</tr>
Hope this may help someone smarter than I solve the problem. : )
Daniel
Any fix to the module configure error:
Warning Missing file. Possible Module "faq" missing!
Also, I noticed that "#" creates a problem with <ol> oldered lists. The following text entered into a FAQ:
# A B C
# DEF
# a
#
# b c
## d e f
#
Produces this text once the FAQ is submitted and then viewed:
1. A B C
2. DEF
1. a
1.
2. b c
1. d e f
2.
The browser code spit out by apache is this:
<ol>
<li> A B C</li>
<li> DEF</li>
</ol>
<ol>
<li> a</li>
</ol>
<ol>
<li></li>
<li> b c </li>
</ol>
<ol>
<li> d e f
<li></li>
</ol>
Similarly,
This:
AuthUserFile "D:\programs\xampplite\apache\conf\.htpd"
Shows up like this:
AuthUserFile &amp;quot;D:programsxamppliteapacheconf.htpd&amp;q uot;
and this:
<meta name="robots" content="noindex, nofollow">
Shows up like this:
<meta name="robots" content="noindex, nofollow">
Can anyone guess where the fix is?
This would seem to be a PHP5 error. I just tried migrating my installation from PHP4.4.6/MySQL5.x to a PHP5 system.
Does anyone have a solution for this, please? I use this nice little module a lot.
When I click the link to open a FAQ I get this error:
Fatal error: Cannot use object of type CFaq as array
in /mypath/---CMS---/dotproject/modules/faq/view.php on line 113.
I've made the changes like the post above.
Here is my kludge for this, and I'm sure there is some more obvious solution. Comment out the offending statement and insert an SQL query as so:
//$faq_date = new CDate( $row['faq_date'] );
//Kludge for fatal error
$sql = "SELECT faq_date FROM faq WHERE faq_id = ".$_GET['faq_id'];
$faq_date = db_loadResult( $sql );
Now go to the line that spits out the date in a table cell, and change it as follows:
<td><?php echo $faq_date; ?></td>
The date won't be formatted as in your prefs though. I'm sure there's some clever person that knows just how to do that.
vBulletin® v3.6.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.