View Full Version : StarSol's FAQ Manager Integration with osTicket !!!
ggbig
01-07-2008, 12:05 AM
Hi all,
I have almost fully integrated StarSol's FAQ Manager (http://www.starsol.co.uk/scripts/free-download-6.html) with osTicket if anyone is interested.
I have only one setback I can find, the part that verifies if you are an admin or staff member is giving me trouble. I have it set now to where you can just go to the admin FAQ Manager without logging in to the admin side, but none of the other admin pages are accessible from there, only the FAQ pages.
I am including the zip of my work on this in hopes someone can finish up the admin login stuff for the FAQ pages so its secure like the other admin stuff.
Also I need to redo the readme text file to reflect the changes and needed code modifications for a few more things I have to do like admin links to the FAQ pages and I don't have the Admin Tabs on the FAQ pages. Minimal stuff but a bit beyond my skills.
I'm hoping that the dev team here at osTicket will like the progress and possibly integrate it fully with the communities help if there is a need for it in a future version. I have only laid the groundwork but will continue to update my add-on to one of the GREAT Open Source Ticket Systems!
Cheers!
almost fully integrated StarSol's FAQ Manager with osTicket if anyone is interested.
Hi ggbig,
Where are you up to with the integration? I'm not a PHP developer but nevertheless I would like to contribute / help. Can you let me know where you are up to (or maybe let me know what it looks like at the moment). I've been looking for an FAQ system for a week now, and I love the idea of integrating it with osTicket.
Please let me know,
G64
ggbig
06-09-2008, 03:19 AM
HI,
Thanks for getting with me. I have not touched this work since I've been so busy with contributioncentral dot com for this year.
I will refer to the work in the ZIP file I've posted and try to reply in a week or two. I have so much CRE Loaded custom work going I may not have much time to look into this.
Gotta go where the money is, especially with gas prices and up coming recession ya know :).
Thanks again. I will certainly try to get with you.
Deep_CuTz
07-01-2008, 08:40 PM
Hi mate,
I found the fix for your login issue if you haven't already.
One file needed changing, three files if you want to further integrate the program.
Firstly, to allow clients to view the content:
Open client.inc.php
Add faq.php to the nologinpages line, so that it looks like this:
//Pages which do not require login.
$nologinpages = array('open.php', 'index.php', 'faq.php');
$thisclient = null;
- Now you can access faq.php without login.
To add it to the main client menu:
Open header.inc.php in the client includes directory
Add a link to the faq.php page in the nav container div like so:
<div id="container">
<ul id="nav">
<?
if(is_object($thisclient) && $thisclient->isValid()) {?>
<li><a class="log_out" href="logout.php">Log Out</a></li>
<li><a class="my_tickets" href="view.php">My Tickets</a></li>
<?}else {?>
<li><a class="ticket_status" href="view.php">Ticket Status</a></li>
<?}?>
<li><a class="new_ticket" href="open.php">New Ticket</a></li>
<li><a class="faqs" href="faq.php">FAQ's</a></li>
<li><a class="home" href="index.php">Home</a></li>
</ul>
<div id="content">
- Now it's added to menu.
Finally, add a custom pic to the menu -
Open main.css in the styles directory.
add a.faqs to the #nav style like so:
#nav a.home { background:url(../images/home.gif) 0 5px no-repeat; }
#nav a.faqs { background:url(../images/faqs.gif) 0 5px no-repeat; }
#nav a.new_ticket { background:url(../images/new_ticket.gif) 0 5px no-repeat; }
#nav a.my_tickets { background:url(../images/my_tickets.gif) 0 5px no-repeat; }
#nav a.ticket_status { background:url(../images/ticket_status.gif) 0 5px no-repeat; }
#nav a.log_out { background:url(../images/logout.gif) 0 5px no-repeat; }
For the admin section fix.
Just open /include/staff/header.inc.php and change the div id header to:
<div id="header">
<p id="info">Welcome back, <strong><?=$thisuser->getUsername()?></strong>
<?php
if($thisuser->isAdmin()) { ?>
| <a href="faq-admin.php?t=index">FAQ's Section</a>
<?}else{?>
<?}?>
<?php
if($thisuser->isAdmin() && !defined('ADMINPAGE')) { ?>
| <a href="admin.php">Admin Panel</a>
<?}else{?>
| <a href="index.php">Staff Panel</a>
<?}?>
| <a href="profile.php?t=pref">My Preference</a> | <a href="logout.php">Log Out</a></p>
</div>
- Now open faq-header.inc.php and change the same area to:
<div id="header">
<p id="info">Welcome back
<?php
if(!defined('ADMINPAGE')) { ?>
| <a href="faq-admin.php?t=index">FAQ's Section</a> | <a href="admin.php">Admin Panel</a>
<?}else{?>
| <a href="index.php">Staff Panel</a>
<?}?>
| <a href="profile.php?t=pref">My Preferences</a> | <a href="logout.php">Log Out</a></p>
</div>
I hope this helps, like so many of you have helped me.
Enjoy, and happy coding.:D:D:)
And your problem is solved!
Peace.
ggbig
07-02-2008, 12:53 PM
Hi there,
Thanks for the info. One day soon I may get back into this integration. I have done nothing but get busier with contributioncentral dot com over the last few months and have had no time for my fun little projects :)
Anyway thatks again for the input!
eWizzard
07-20-2008, 05:54 AM
Thank you all for this contribution.
I saw that the last step is still missing: you may want to secure the scp/faq-admin.php page with the same login that you use for the osTicket admin.
Just add the following rows to faq-admin.php (the code has been taken from admin.php of osTicket)
require('staff.inc.php');
//Make sure the user is admin type LOCKDOWN BABY!
if(!$thisuser or !$thisuser->isadmin()){
header('Location: index.php');
require('index.php'); // just in case!
exit;
}
Now if you browse to faq-admin.php you will need to login with your osTicket parameters.
I'm trying now to show the faqlink also to managers and/or staff... and a search function for the FAQ would be great.
Axel
eWizzard
07-20-2008, 12:49 PM
OK, I did some copy & paste from other functions in the script and here's the FAQ search & filter function.
I took the faq_list module from faq_admin.php
Stripped away the link to the admin functions and edit/reset/delete
I added a link to the result with target=_top to point to the detailed question/answer
I copied it in the faq.php file and inserted the following code just after the last "break;" (should be somewhere around row 266)
// faq_list code start
case "faq_list":
if (!$_GET[category]){
$_GET[category] = 'All Categories';
}
if (!$_GET[o]){
$_GET[o] = 'qu';
}
if (!$_GET[aod]){
$_GET[aod] = 'ASC';
}
if (!$_GET[limit]){
$_GET[limit] = '50';
}
echo'<h1>Questions List</h1>'."\n\n";
echo'<table class="list-table"><tr>'."\n";
echo'<form action="'.$_SERVER[PHP_SELF].'" method="get">'."\n".'<input type="hidden" name="t" value="faq_list" />'."\n";
echo'<td style="padding: 3px; font-size: 10pt; border: 1px solid #000000;">Category:<br />'."\n".'<select name="category" size="1">'."\n".'<option selected>'.$_GET[category].'</option>'."\n";
if ($_GET[category] != 'All Categories'){
echo'<option>All Categories</option>'."\n";
}
$categories = @mysql_query('SELECT name FROM '.$db_prefix.'c ORDER BY uin ASC') or deal_with_mysql_error('Categories Data Retrieval MySQL Error (faq_list). '.mysql_error(),'admin');
while ($row = mysql_fetch_array($categories, MYSQL_NUM)) {
echo'<option>'.$row[0].'</option>'."\n";
}
echo'</select>'."\n".'</td>'."\n";
echo'<td style="padding: 3px; font-size: 10pt; border: 1px solid #000000;">Containing:<br />'."\n".'<input type="text" size="10" value="'.$_GET[containing].'" name="containing">'."\n".'</td>'."\n";
echo'<td style="padding: 3px; font-size: 10pt; border: 1px solid #000000;">Order By:<br />'."\n".'<select name="o" size="1">'."\n";
if ($_GET[o] == "qu"){echo'<option selected value="qu">Question</option>'."\n"; $o_show = 'Question';}else{echo'<option value="qu">Question</option>'."\n";}
if ($_GET[o] == "an"){echo'<option selected value="an">Answer</option>'."\n"; $o_show = 'Answer';}else{echo'<option value="an">Answer</option>'."\n";}
if ($_GET[o] == "rating"){echo'<option selected value="rating">Rating</option>'."\n"; $o_show = 'Rating';}else{echo'<option value="rating">Rating</option>'."\n";}
echo'</select>'."\n".' ';
echo'<select name="aod" size="1">'."\n";
if ($aod == "ASC"){echo'<option selected value="ASC">Ascending</option>'."\n";}else{echo'<option value="ASC">Ascending</option>'."\n";}
if ($aod == "DESC"){echo'<option selected value="DESC">Descending</option>'."\n";}else{echo'<option value="DESC">Descending</option>'."\n";}
echo'</select>'."\n".'</td>'."\n";
echo'<td style="padding: 3px; font-size: 10pt; border: 1px solid #000000;">Limit:<br />'."\n".'<input type="text" size="4" value="'.$_GET[limit].'" name="limit">'."\n".'</td>'."\n";
echo'<td style="padding: 3px; font-size: 10pt; border: 1px solid #000000;"><input type="submit" value="Change Filter" /></td>'."\n";
echo'</form>'."\n".'</tr>'."\n".'</table>'."\n\n";
if ($_GET[category] AND $_GET[category] != 'All Categories'){
if (mysql_num_rows(mysql_query('SELECT uin FROM '.$db_prefix.'c WHERE name="'.$_GET[category].'"')) == '0'){
error_message('The category specified does not exist. Please go back and try again. If the problem persists, please contact technical <a href="'.$_SERVER[PHP_SELF].'?t=support">support</a>.');
@mysql_close();
exit;
} else {
if ($where){
$where .= ' AND category="'.$_GET[category].'"';
} else {
$where = 'WHERE category="'.$_GET[category].'"';
}
}
}
if ($_GET[o] == 'an'){
$qoa = 'Answer';
$sqoa = 'an';
} else {
$qoa = 'Question';
$sqoa = 'qu';
}
if ($_GET[containing]){
if ($where){
$where .= ' AND '.$sqoa.' LIKE "%'.$_GET[containing].'%"';
} else {
$where = 'WHERE '.$sqoa.' LIKE "%'.$_GET[containing].'%"';
}
}
echo'<table class="list-table" style="margin-top: 10px;">'."\n";
echo'<tr><td class="list-heading">'.$qoa.'</td><td class="list-heading" nowrap="nowrap">Category</td><td class="list-heading">Rating</td><td class="list-heading" nowrap="nowrap">Tools</td></tr>'."\n";
$faq_query = 'SELECT uin,'.$sqoa.',category,rating,rc FROM '.$db_prefix.'q '.$where.' ORDER BY '.$_GET[o].' '.$_GET[aod].' LIMIT '.$_GET[limit];
$result = @mysql_query($faq_query) or deal_with_mysql_error('FAQs Data Retrieval MySQL Error (faq_list). '.mysql_error(),'admin');
if (mysql_num_rows($result) == "0"){
echo'<tr><td style="padding: 3px; font-size: 10pt; border: 1px solid #000000;" colspan="4">There are no frequently asked questions in the database matching the criteria in the filter above.</td></tr>'."\n";
} else {
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
if (strlen($row[1]) > 77){
$row[1] = substr($row[1], 0, 75).'...';
}
if (!$row[4]){
$row[3] = 'None';
} else {
$row[3] .= '% of '.$row[4];
}
echo'<tr><td style="padding: 3px; font-size: 10pt; border: 1px solid #000000;"><a href="faq.php?t=sq&uin='.$row[0].'" target="_top">'.$row[1].'</a></td><td style="padding: 3px; font-size: 10pt; border: 1px solid #000000;">'.htmlentities($row[2], ENT_QUOTES).'</td><td style="padding: 3px; font-size: 10pt; border: 1px solid #000000;">'.$row[3].'</td></tr>'."\n";
}
}
echo''."\n".'</table>'."\n\n";
break;
// faq_list code end
Now you can call the "public" faq_list with faq.php?t=faq_list.
Then I added this code to the faq.php file to link to the list:
around row 48 replace the code with this one (or just add the bold text with the link)
//start modified code to link to faq_list
$main_content .= '<p class="prose" style="text-align: left;">The following is a list of all categories of frequently asked questions that are currently in our database.<br> Select a category or <a href="faq.php?t=faq_list" target="_top">search/filter FAQ</a>:</p>'."\n";
//end modified code to link to faq_list
Deep_CuTz
07-29-2008, 10:44 PM
nice work - Will have to give this one a try!
ryan.toolking
04-14-2009, 02:21 PM
Just a slight change to Deep_CuTz mod to faq-header.inc.php and change the same area to inlcude the logo image and user name..
<div id="container">
<div id="header">
<a id="logo" href="index.php" title="osTicket"><img src="images/ostlogo.jpg" width="188" height="72" alt="osTicket"></a>
<p id="info">Welcome back, <strong><?=$thisuser->getUsername()?></strong>
<?php
if(!defined('ADMINPAGE')) { ?>
| <a href="faq-admin.php?t=index">FAQ's Section</a> | <a href="admin.php">Admin Panel</a>
<?}else{?>
| <a href="index.php">Staff Panel</a>
<?}?>
| <a href="profile.php?t=pref">My Preferences</a> | <a href="logout.php">Log Out</a></p>
</div>
ryan.toolking
04-14-2009, 05:36 PM
I've successfully installed and modified this StarSol's FAQ manager with the help and suggestions from those posting above and have re-packaged all the modded files in a handy zip for anyone else that would like to use this amazing modification without having to edit all those files.
This mod has cut down our support tickets by nearly half and make our customer support staff very happy.
There is a new readme file that covers the slight installation changes for osTicket and documents the changes covered in this thread
Even included a simple faq.gif image for the client link that matches the default theme.
:D
craigreilly
04-15-2009, 03:24 PM
I get this error on any databse add:
Question Insertion MySQL Error (faq_new). Out of range value adjusted for column 'uin' at row 1
I have updated the insert statements to fix this to
insert into table (column,column) values (val1, val2)
Also this when rating from the front end:
Warning: Cannot modify header information - headers already sent by (output started at D:\helpdesk\include\client\header.inc.php:9) in D:\helpdesk\faq.php on line 264
So I turned ratings off for now.
Lastly - maybe the FAQ Categories could be replaced with the OST_Help_Topic Table. ??? Anyone have any thoughts on this?
I have done this to my install as well as a couple other small changes such as having FAQ_Q table as available for OST Ticket Replies (like OST_KB_PREMADE).
I also removed some target= on HREF's so It does not break my Joomla Wrapper.
I would wrap my changes up and upload them - but I also made a lot of changes to the OST files as well to make this work for our needs as well and it might break other installs.
Thanks to all who worked on this.
craigreilly
04-15-2009, 08:08 PM
Here is a modified search which checks all words.
I will probably add a filter for "ALL WORDS" "ANY WORDS"
This goes in faq.php under
if ($_GET[containing]){
//Get Number of words
$words=substr_count($_GET[containing]," ")+1;
//Create Array from words
$parts=explode(" ",$_GET[containing]);
//echo $words;
if ($where){
$where .= ' AND (';
} else {
$where = 'WHERE (';
}
//Create Select Statement from Parts Array
for ($counter=0; $counter<$words;$counter+=1)
{
//echo $parts[$counter];
if ($where){
if ($counter>0) { $where .= ' OR '; }
$where .= $sqoa.' LIKE "%'.$parts[$counter].'%"';
} else {
if ($counter>0) { $where .= ' OR '; }
$where = $sqoa.' LIKE "%'.$parts[$counter].'%"';
}
}
$where .= ')';
oriecat
05-08-2009, 07:39 PM
Is there any way to integrate this with the premade replies so that staff can use them and you don't have to enter all of the questions twice?