FEATURES: - Easy ability to add new catagories (Via Ticket Admin Panel) - Assign tickets to users (Via user id) - It's better than the existing ticket system INSTALLATION HOW TO: 1) Download this file & extract to sections/tickets (need to delete old files or rename to 'file.old'): https://dl.getdropbox.com/u/274817/tickets.tar.gz 2) In sections/user/edit.php: Locate the Following: Code: Download torrents as text files checked="checked" /> And replace with: Code: Download torrents as text files checked="checked" /> Notify on ticket replies checked="checked" /> 3) In sections/user/index.php Locate the following: Code: $DownloadAlt = (isset($_POST['downloadalt']))? 1:0; And replace with: Code: $DownloadAlt = (isset($_POST['downloadalt']))? 1:0; $TicketNotify = (isset($_POST['ticket_notify']))? 1:0; Locate the following: Code: $SQL="UPDATE users_main AS m JOIN users_info AS i ON m.ID=i.UserID SET i.StyleID='".db_string($_POST['stylesheet'])."', i.StyleURL='".db_string($_POST['styleurl'])."', i.Avatar='".db_string($_POST['avatar'])."', i.SiteOptions='".db_string(serialize($Options))."', i.Info='".db_string($_POST['info'])."', i.DownloadAlt='$DownloadAlt', m.Email='".db_string($_POST['email'])."', m.IRCKey='".db_string($_POST['irckey'])."', m.Paranoia='".db_string($_POST['paranoia'])."'"; And replace with: Code: $SQL="UPDATE users_main AS m JOIN users_info AS i ON m.ID=i.UserID SET i.StyleID='".db_string($_POST['stylesheet'])."', i.StyleURL='".db_string($_POST['styleurl'])."', i.Avatar='".db_string($_POST['avatar'])."', i.SiteOptions='".db_string(serialize($Options))."', i.Info='".db_string($_POST['info'])."', i.DownloadAlt='$DownloadAlt', i.TicketNotify='$TicketNotify', m.Email='".db_string($_POST['email'])."', m.IRCKey='".db_string($_POST['irckey'])."', m.Paranoia='".db_string($_POST['paranoia'])."'"; 4) In design/privateheader.php Locate the following: Code: if(check_perms('site_resolve_tickets')) { // Number of unresolved tickets $NumNewTickets = $Cache->get_value('numnewtickets'); if($NumNewTickets === false){ $DB->query('SELECT COUNT(ID) FROM tickets WHERE Status = \'New\' OR Status = \'Reopened\''); list($NumNewTickets) = $DB->next_record(); // The cached value is reset every hour, or when someone checks up on a user $Cache->cache_value('numnewtickets', $NumNewTickets, 3600); } } ?>
ToolBox | Report | Ticket | Watched
And replace with: Code: if(check_perms('tickets_status_change')) { // Number of unresolved tickets $NumNewTickets = $Cache->get_value('numnewtickets'); if($NumNewTickets === false){ $DB->query('SELECT COUNT(ID) FROM tickets WHERE Status=0 OR Status=2'); list($NumNewTickets) = $DB->next_record(); // The cached value is reset every hour, or when someone checks up on a user $Cache->cache_value('numnewtickets', $NumNewTickets, 3600); } } ?>
ToolBox | Report | Ticket | Watched
5) Execute the following mysql query (erases old ticket system): Code: DROP TABLE IF EXISTS `tickets`; CREATE TABLE `tickets` ( `ID` int(10) NOT NULL auto_increment, `AuthorID` int(10) NOT NULL, `Category` int(3) NOT NULL default '1', `AssignedID` int(10) default NULL, `Name` varchar(40) default NULL, `Date` datetime default NULL, `LatestActivity` datetime default NULL, `Body` mediumtext, `EditedUserID` int(10) default NULL, `EditedTime` datetime default NULL, `Status` int(3) NOT NULL, `StatusSetBy` int(10) NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `tickets_replies`; CREATE TABLE `tickets_replies` ( `ID` int(10) NOT NULL auto_increment, `TicketID` int(10) NOT NULL, `AuthorID` int(10) NOT NULL, `Body` mediumtext, `EditedUserID` int(10) default NULL, `EditedTime` datetime default NULL, `AddedTime` datetime default NULL, PRIMARY KEY (`ID`), KEY `TicketID` (`TicketID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `tickets_categories`; CREATE TABLE `tickets_categories` ( `ID` int(3) NOT NULL auto_increment, `Name` varchar(40) NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO tickets_categories (Name) VALUES ('Site: Bugs'); 6) In classes/permissions_form.php Remove the following: Code: Locate the following: Code:
Administrative
And replace with: Code:
Administrative
Tickets
7) In static/functions/forums.js Add the following functions (Just add to the top of the document): Code: function showHidden(divid) { if(document.getElementById(divid).style.display == 'none') { document.getElementById(divid).style.display = ''; } } function hideShown(divid) { if(document.getElementById(divid).style.display != 'none'){ document.getElementById(divid).style.display = 'none'; } } Locate the following: Code: function Quote(postid, username) { try { quote = new XMLHttpRequest(); } catch(e) { quote = new ActiveXObject("Microsoft.XMLHTTP") }; quote.onreadystatechange = function() { if (quote.readyState == 4 && quote.status == 200) { $('quickpost').value = "[quote=" + username + "]" + quote.responseText + "[/quote]"; } }; if (location.href.match(/forums\.php/)) { quote.open("GET", "forums.php?action=get_post&post=" + postid, true); } else { quote.open("GET", "torrents.php?action=get_post&post=" + postid, true); } quote.send(null); } And replace with: Code: function Quote(postid, username) { try { quote = new XMLHttpRequest(); } catch(e) { quote = new ActiveXObject("Microsoft.XMLHTTP") }; quote.onreadystatechange = function() { if (quote.readyState == 4 && quote.status == 200) { $('quickpost').value = "[quote=" + username + "]" + quote.responseText + "[/quote]"; } }; if (location.href.match(/forums\.php/)) { quote.open("GET", "forums.php?action=get_post&post=" + postid, true); } else if (location.href.match(/torrents\.php/)) { quote.open("GET", "torrents.php?action=get_post&post=" + postid, true); } else { quote.open("GET", "tickets.php?action=get_post&post=" + postid, true); } quote.send(null); } Locate the following: Code: function Edit_Form(postid) { if (location.href.match(/forums\.php/)) { pageUrl="forums"; boxWidth="80"; } else { pageUrl="torrents"; boxWidth="50"; } $('bar' + postid).cancel = $('content' + postid).innerHTML; $('content' + postid).innerHTML = "
"; $('bar' + postid).innerHTML = ""; try { editform = new XMLHttpRequest(); } catch(e) { editform = new ActiveXObject("Microsoft.XMLHTTP") }; editform.onreadystatechange = function() { if (editform.readyState == 4 && editform.status == 200) { $('editbox' + postid).value = editform.responseText; } }; editform.open("GET", pageUrl+".php?action=get_post&post=" + postid, true); editform.send(null); } And replace with: Code: function Edit_Form(postid) { if (location.href.match(/forums\.php/)) { pageUrl="forums"; boxWidth="80"; } else if (location.href.match(/forums\.php/)) { pageUrl="torrents"; boxWidth="50"; } else { pageUrl="tickets"; boxWidth="50"; } $('bar' + postid).cancel = $('content' + postid).innerHTML; $('content' + postid).innerHTML = "
"; $('bar' + postid).innerHTML = ""; try { editform = new XMLHttpRequest(); } catch(e) { editform = new ActiveXObject("Microsoft.XMLHTTP") }; editform.onreadystatechange = function() { if (editform.readyState == 4 && editform.status == 200) { $('editbox' + postid).value = editform.responseText; } }; editform.open("GET", pageUrl+".php?action=get_post&post=" + postid, true); editform.send(null); } Locate the following: Code: function Delete(postid,authkey) { if (confirm('Are you sure you wish to delete this post?') == true) { try { delpost = new XMLHttpRequest(); } catch(e) { delpost = new ActiveXObject("Microsoft.XMLHTTP") }; delpost.onreadystatechange = function() { if (delpost.readyState == 4 && delpost.status == 200) { $('post' + postid).style.display = "none"; } }; if (location.href.match(/forums\.php/)) { delpost.open("GET", "forums.php?action=delete&auth=" + authkey + "&postid=" + postid, true); } else { delpost.open("GET", "torrents.php?action=delete_post&auth=" + authkey + "&postid=" + postid, true); } delpost.send(null); } } And replace with: Code: function Delete(postid,authkey) { if (confirm('Are you sure you wish to delete this post?') == true) { try { delpost = new XMLHttpRequest(); } catch(e) { delpost = new ActiveXObject("Microsoft.XMLHTTP") }; delpost.onreadystatechange = function() { if (delpost.readyState == 4 && delpost.status == 200) { $('post' + postid).style.display = "none"; } }; if (location.href.match(/forums\.php/)) { delpost.open("GET", "forums.php?action=delete&auth=" + authkey + "&postid=" + postid, true); } else if (location.href.match(/torrents\.php/)) { delpost.open("GET", "torrents.php?action=delete_post&auth=" + authkey + "&postid=" + postid, true); } else { delpost.open("GET", "tickets.php?action=delete_post&auth=" + authkey + "&postid=" + postid, true); } delpost.send(null); } } Locate the following: Code: function Save_Edit(postid) { $('bar' + postid).innerHTML = ""; var parameters = serialize('form' + postid); try { post_sub= new XMLHttpRequest(); post_sub.overrideMimeType('text/html'); } catch(e) { post_sub = new ActiveXObject("Microsoft.XMLHTTP") } post_sub.onreadystatechange = function() { if (post_sub.readyState == 4 && post_sub.status == 200) { $('content' + postid).innerHTML = post_sub.responseText; } }; if (location.href.match(/forums\.php/)) { post_sub.open('POST', 'forums.php?action=takeedit', true); } else { post_sub.open('POST', 'torrents.php?action=takeedit_post', true); } post_sub.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); post_sub.setRequestHeader("Content-length", parameters.length); post_sub.setRequestHeader("Connection", "close"); post_sub.send(parameters); } And replace with: Code: function Save_Edit(postid) { $('bar' + postid).innerHTML = ""; var parameters = serialize('form' + postid); try { post_sub= new XMLHttpRequest(); post_sub.overrideMimeType('text/html'); } catch(e) { post_sub = new ActiveXObject("Microsoft.XMLHTTP") } post_sub.onreadystatechange = function() { if (post_sub.readyState == 4 && post_sub.status == 200) { $('content' + postid).innerHTML = post_sub.responseText; } }; if (location.href.match(/forums\.php/)) { post_sub.open('POST', 'forums.php?action=takeedit', true); } else if (location.href.match(/torrents\.php/)) { post_sub.open('POST', 'torrents.php?action=takeedit_post', true); } else { post_sub.open('POST', 'tickets.php?action=takeedit_post', true); } post_sub.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); post_sub.setRequestHeader("Content-length", parameters.length); post_sub.setRequestHeader("Connection", "close"); post_sub.send(parameters); } 8) Append to all of your stylesheets (static/styles/*/style.css): Code: .tickets_search { width: 800px; margin-left: auto; margin-right: auto; font-size: 8pt; } .tickets_categories { float: left; text-align: left; padding: .5em; } .tickets_status { float: right; padding: 0.5em; text-align: left; } .small_label { width: 0%; text-align: right; font-weight: bold; } .filter_tickets { width:850px; margin-left:auto; margin-right:auto; margin-bottom:15px; } .filter_tickets .submit { text-align:right; padding-top:5px; } 9) Associate the approiate permissions for the ticket system (Via Toolbox > Managers > Permissions