diff --git a/gazelle.sql b/gazelle.sql
index ed3116a3..0c8166f9 100644
--- a/gazelle.sql
+++ b/gazelle.sql
@@ -538,6 +538,8 @@ CREATE TABLE `reports` (
`ResolvedTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ReportedTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Reason` text COLLATE utf8_bin NOT NULL,
+ `ClaimerID` int(10) unsigned NOT NULL DEFAULT '0',
+ `Notes` text COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`ID`),
KEY `Status` (`Status`),
KEY `Type` (`Type`),
diff --git a/sections/collages/manage.php b/sections/collages/manage.php
index cf9b4867..52d4540b 100644
--- a/sections/collages/manage.php
+++ b/sections/collages/manage.php
@@ -103,9 +103,9 @@
=$Number?> |
- =trim($CatNum)?> |
- =trim($GroupYear)?> |
- =trim($DisplayName)?> |
+ =trim($CatNum) ?: ' '?> |
+ =trim($GroupYear) ?: ' '?> |
+ =trim($DisplayName) ?: ' '?> |
=trim($TorrentLink)?> |
=Users::format_username($UserID, $Username, false, false, false)?> |
diff --git a/sections/reports/ajax_add_notes.php b/sections/reports/ajax_add_notes.php
new file mode 100644
index 00000000..9ac228d6
--- /dev/null
+++ b/sections/reports/ajax_add_notes.php
@@ -0,0 +1,25 @@
+ 'failure'
+ )
+ );
+ die();
+}
+
+$ID = (int) $_GET['id'];
+
+$Notes = str_replace(" ", "\n", $_GET['notes']);
+$Notes = db_string($Notes);
+
+$DB->query("UPDATE reports SET Notes = '$Notes' WHERE ID = '$ID'");
+print
+ json_encode(
+ array(
+ 'status' => 'success'
+ )
+ );
+exit();
diff --git a/sections/reports/ajax_claim_report.php b/sections/reports/ajax_claim_report.php
new file mode 100644
index 00000000..5f01ba42
--- /dev/null
+++ b/sections/reports/ajax_claim_report.php
@@ -0,0 +1,35 @@
+ 'failure'
+ )
+ );
+ die();
+}
+
+$ID = (int)$_GET['id'];
+$DB->query("SELECT ClaimerID FROM reports WHERE ID = '$ID'");
+list($ClaimerID) = $DB->next_record();
+if ($ClaimerID) {
+ print
+ json_encode(
+ array(
+ 'status' => 'dupe'
+ )
+ );
+ exit();
+} else {
+ $UserID = $LoggedUser['ID'];
+ $DB->query("UPDATE reports SET ClaimerID = '$UserID' WHERE ID = '$ID'");
+ print
+ json_encode(
+ array(
+ 'status' => 'success',
+ 'username' => $LoggedUser['Username']
+ )
+ );
+ exit();
+}
\ No newline at end of file
diff --git a/sections/reports/index.php b/sections/reports/index.php
index 20280320..d03f0cc9 100644
--- a/sections/reports/index.php
+++ b/sections/reports/index.php
@@ -24,6 +24,12 @@
case 'takecompose':
include(SERVER_ROOT.'/sections/reports/takecompose.php');
break;
+ case 'add_notes':
+ include(SERVER_ROOT.'/sections/reports/ajax_add_notes.php');
+ break;
+ case 'claim':
+ include(SERVER_ROOT.'/sections/reports/ajax_claim_report.php');
+ break;
default:
include(SERVER_ROOT.'/sections/reports/reports.php');
break;
diff --git a/sections/reports/reports.php b/sections/reports/reports.php
index ea59f407..15d9f636 100644
--- a/sections/reports/reports.php
+++ b/sections/reports/reports.php
@@ -1,46 +1,45 @@
/************************************************************************
-
************************************************************************/
-if(!check_perms('admin_reports') && !check_perms('project_team') && !check_perms('site_moderate_forums')) {
+if (!check_perms('admin_reports') && !check_perms('project_team') && !check_perms('site_moderate_forums')) {
error(404);
}
// Number of reports per page
define('REPORTS_PER_PAGE', '10');
-include(SERVER_ROOT.'/classes/class_text.php');
+include(SERVER_ROOT . '/classes/class_text.php');
$Text = NEW TEXT;
-list($Page,$Limit) = Format::page_limit(REPORTS_PER_PAGE);
+list($Page, $Limit) = Format::page_limit(REPORTS_PER_PAGE);
-include(SERVER_ROOT.'/sections/reports/array.php');
+include(SERVER_ROOT . '/sections/reports/array.php');
// Header
-View::show_header('Reports','bbcode');
+View::show_header('Reports', 'bbcode,reports');
-if($_GET['id'] && is_number($_GET['id'])) {
+if ($_GET['id'] && is_number($_GET['id'])) {
$View = "Single report";
- $Where = "r.ID = ".$_GET['id'];
-} else if(empty($_GET['view'])) {
+ $Where = "r.ID = " . $_GET['id'];
+} else if (empty($_GET['view'])) {
$View = "New";
$Where = "Status='New'";
} else {
$View = $_GET['view'];
- switch($_GET['view']) {
+ switch ($_GET['view']) {
case 'old' :
$Where = "Status='Resolved'";
break;
- default :
+ default :
error(404);
break;
}
}
-if(!check_perms('admin_reports')) {
- if(check_perms('project_team')) {
+if (!check_perms('admin_reports')) {
+ if (check_perms('project_team')) {
$Where .= " AND Type = 'request_update'";
}
- if(check_perms('site_moderate_forums')) {
+ if (check_perms('site_moderate_forums')) {
$Where .= " AND Type IN('collages_comment', 'Post', 'requests_comment', 'thread', 'torrents_comment', 'torrent_comments')";
}
@@ -54,12 +53,14 @@
r.Type,
r.ReportedTime,
r.Reason,
- r.Status
+ r.Status,
+ r.ClaimerID,
+ r.Notes
FROM reports AS r
JOIN users_main AS um ON r.UserID=um.ID
- WHERE ".$Where."
+ WHERE " . $Where . "
ORDER BY ReportedTime
- DESC LIMIT ".$Limit);
+ DESC LIMIT " . $Limit);
// Number of results (for pagination)
$DB->query('SELECT FOUND_ROWS()');
@@ -71,165 +72,182 @@
// Start printing stuff
?>
-
-
-
-// pagination
-$Pages = Format::get_pages($Page,$Results,REPORTS_PER_PAGE,11);
-echo $Pages;
-?>
-
-
-while(list($ReportID, $SnitchID, $SnitchName, $ThingID, $Short, $ReportedTime, $Reason, $Status) = $DB->next_record()) {
- $Type = $Types[$Short];
- $Reference = "reports.php?id=".$ReportID."#report".$ReportID;
-?>
-
-
-
- $DB->set_query_id($Reports);
-}
-?>
-
-
- echo $Pages;
-?>
-
+ ?>
+
+
+ echo $Pages;
+ ?>
+
View::show_footer();
diff --git a/static/functions/reports.js b/static/functions/reports.js
new file mode 100644
index 00000000..a71456bb
--- /dev/null
+++ b/static/functions/reports.js
@@ -0,0 +1,37 @@
+function toggleNotes(id) {
+ var style = $('#notes_div_' + id).raw().style.display;
+ if (style == "none") {
+ $('#notes_div_' + id).raw().style.display = "block";
+ }
+ else {
+ $('#notes_div_' + id).raw().style.display = "none";
+ }
+}
+
+function saveNotes(id) {
+ var notes = $('#notes_' + id).raw().value;
+ notes = notes.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, ' ');
+ ajax.get('reports.php?action=add_notes&id=' + id + '¬es=' + notes, function (response) {
+ if (JSON.parse(response)['status'] != 'success') {
+ alert("Error, could not save notes");
+ }
+ });
+
+}
+
+function claim(id) {
+ ajax.get('reports.php?action=claim&id=' + id, function (response) {
+ var json = JSON.parse(response);
+ if (json['status'] == 'failure') {
+ alert("Error, could not claim.");
+ }
+ if (json['status'] == 'dupe') {
+ alert("Oops, this report has already been claimed.");
+ }
+ if (json['status'] == 'success') {
+ var username = json['username'];
+ $('#claim_' + id).raw().innerHTML = 'Claimed by ' + username + '';
+ }
+ });
+}
+
|