Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

RSS feed of tickets.

Sorry if this already exists, I had a look and couldn't find. I wrote it for use at our organisation here, but thought it might be useful to others.

This is a mod that will allow users to subscribe to feeds containing
  • All tickets
  • All unassinged tickets
  • Tickets assigned to them
  • All open tickets
or any combination of the above. It generates a feed URL on the user's profile page with a key specific to the user, and the URL contains flags for what tickets they would like included (as above). This also means that one user can use different 'views' of the feed for different things.

This mod is based on v1.6ST which I believe is current at the moment.
This does assume that osTicket is installed in the root folder, i.e. http://helpdesk.domain.tld/ - you may need to update some paths if not.

Step one, open include/class.staff.php and at about line 41, you'll find:
$sql=sprintf(\"SELECT * FROM \".STAFF_TABLE.\" LEFT JOIN \".GROUP_TABLE.\" USING(group_id) WHERE %s=%s \", is_numeric($var)?'staff_id':'username',db_input($var));


change it to read:
$sql=sprintf(\"SELECT *,MD5(CONCAT(username,passwd)) as feedkey FROM \".STAFF_TABLE.\" LEFT JOIN \".GROUP_TABLE.\" USING(group_id) WHERE %s=%s \", is_numeric($var)?'staff_id':'username',db_input($var));


Then open include/staff/myprofile.inc.php and add the following at line 6 (just after
My Profile Info
):
<script>
function rssUpdate() {
var flags = \"\";
var baseUrl = \"http://<?=$_SERVER['HTTP_HOST'].preg_replace(\"/\/.+\.php$/\", \"\", $_SERVER['REQUEST_URI'])?>/rss/feed/<?=$rep['feedkey']?>\";

if(document.getElementById('rssAll').value){
flags = flags + \"a\";
}
if(document.getElementById('rssOpen').value){
flags = flags + \"o\";
}
if(document.getElementById('rssMine').value){
flags = flags + \"m\";
}
if(document.getElementById('rssUnassigned').value){
flags = flags + \"u\";
}
if(flags){
document.getElementById('rssUrl').value = baseUrl + \"/\" + flags;
}else{
document.getElementById('rssUrl').value = baseUrl
}
}
</script>


Then find (probably around line 78ish after the modifications above, basically down at the end of the file) and before the add:

 <tr><td>RSS Feed:</td>
<td><input type=\"text\" id=\"rssUrl\" value=\"http://<?=$_SERVER['HTTP_HOST'].preg_replace(\"/\/.+\.php$/\", \"\", $_SERVER['REQUEST_URI'])?>/rss/feed/<?=$rep['feedkey']?>\" style='width: 70%;'/></td></tr>
<tr><td>Show feed for:<br/><span style='font-size: 8pt;'>(tick all that apply)</span></td><td><input type='checkbox' id='rssAll' onClick='rssUpdate();' />All Tickets <input type='checkbox' id='rssOpen' onClick='rssUpdate();' />All Open Tickets <input type='checkbox' id='rssMine' onClick='rssUpdate();' />Tickets Assigned to me <input type='checkbox' onClick='rssUpdate();' id='rssUnassigned' />Unassigned Tickets<br/>
<span style='font-size: 8pt;'>Tickets that appear with [*] in the title are assigned to you. Tickets with [!] are unassigned.<br/><i>After changing your RSS options, you will need to re-subscribe to the feed, as the URL will have changed.</i></span></td></tr>


Open .htaccess in the root folder and add:
RewriteEngine On
RewriteRule ^rss/feed/(.+)/(.+)$ /rss/index.php?feedKey=$1&requestType=$2
RewriteRule ^rss/feed/(.+)$ /rss/index.php?feedKey=$1


Finally, create a folder called /rss and put the attached index.txt in it, renaming it index.php - be sure to open up index.php and change the value of $osTicket to the domain of your osTicket install.

Hope someone finds it useful! :)

Comments

  • I have osticket in other folders..
    i.e not as your details above.. subdomain.domain.tld..
    Will anything other than the domain extension in new file need to be changed..
    i.e any of your mods code need altering.. ?

    Cheers
    K
  • axiscars, i also have similar issue, have you got it fixed ? thanks in advance
  • no index.txt?
Sign In or Register to comment.