From ed6863ea3289511abf58110dd80b2072941bde22 Mon Sep 17 00:00:00 2001 From: Git Date: Thu, 10 Oct 2013 08:01:46 +0000 Subject: [PATCH] Empty commit --- classes/top10view.class.php | 13 +- sections/ajax/grab_report.php | 20 - sections/ajax/index.php | 6 - .../ajax_giveback_report.php} | 4 +- sections/reportsv2/ajax_new_report.php | 21 +- sections/reportsv2/index.php | 31 +- sections/reportsv2/reports.php | 6 +- sections/reportsv2/static.php | 610 +++++++++--------- sections/reportsv2/takeresolve.php | 15 +- sections/reportsv2/views.php | 179 +++-- sections/tools/development/update_geoip.php | 4 +- sections/top10/lastfm.php | 13 +- sections/torrents/delete.php | 36 +- sections/torrents/download.php | 2 +- static/functions/reportsv2.js | 265 ++++---- static/styles/anorex/style.css | 15 +- static/styles/dark_ambient/style.css | 14 + static/styles/global.css | 20 + static/styles/kuro/style.css | 19 +- static/styles/layer_cake/style.css | 15 +- static/styles/mono/style.css | 7 + static/styles/postmod/style.css | 13 +- static/styles/proton/style.css | 21 + static/styles/white.cd/style.css | 8 +- 24 files changed, 655 insertions(+), 702 deletions(-) delete mode 100644 sections/ajax/grab_report.php rename sections/{ajax/giveback_report.php => reportsv2/ajax_giveback_report.php} (92%) diff --git a/classes/top10view.class.php b/classes/top10view.class.php index 0b2fdeb5..6e8006ab 100644 --- a/classes/top10view.class.php +++ b/classes/top10view.class.php @@ -49,10 +49,12 @@ public static function render_artist_tile($Artist, $Category) { } private static function render_tile($Url, $Name, $Image) { - if (!empty($Image)) { ?> + if (!empty($Image)) { + $Name = htmlspecialchars($Name); + ?>
  • - + <?=$Name?>
  • \""; + $Title = "title=\"<img class="large_tile" src="$Image" alt="" />\""; + $Name = htmlspecialchars($Name); ?>
  • - href=""> - - + href="">
  • query(" - UPDATE reportsv2 - SET Status = 'New' - WHERE ID = ".$_GET['id']." - AND Status != 'Resolved'"); -if ($DB->affected_rows() > 0) { - //Win -} else { - echo 'You just tried to grab a resolved or nonexistent report!'; -} -?> diff --git a/sections/ajax/index.php b/sections/ajax/index.php index 3deff675..b7d8242b 100644 --- a/sections/ajax/index.php +++ b/sections/ajax/index.php @@ -47,12 +47,6 @@ case 'torrent_info': require('torrent_info.php'); break; - case 'giveback_report': - require('giveback_report.php'); - break; - case 'grab_report': - require('grab_report.php'); - break; case 'stats': require(SERVER_ROOT . '/sections/ajax/stats.php'); break; diff --git a/sections/ajax/giveback_report.php b/sections/reportsv2/ajax_giveback_report.php similarity index 92% rename from sections/ajax/giveback_report.php rename to sections/reportsv2/ajax_giveback_report.php index e2a125a2..4e6c17bd 100644 --- a/sections/ajax/giveback_report.php +++ b/sections/reportsv2/ajax_giveback_report.php @@ -1,10 +1,10 @@ query(" diff --git a/sections/reportsv2/ajax_new_report.php b/sections/reportsv2/ajax_new_report.php index b6a1d534..787bf0ff 100644 --- a/sections/reportsv2/ajax_new_report.php +++ b/sections/reportsv2/ajax_new_report.php @@ -89,15 +89,10 @@ LastChangeTime = '".sqltime()."', ModComment = 'Report already dealt with (torrent deleted)' WHERE ID = $ReportID"); + $Cache->decrement('num_torrent_reportsv2'); ?> -
    - - - - -
    - Report for torrent (deleted) has been automatically resolved. -
    +
    + Report for torrent (deleted) has been automatically resolved.
    -
    +
    - @@ -152,7 +146,7 @@
    - +
    Reported torrent: @@ -428,9 +422,4 @@
    -
    - diff --git a/sections/reportsv2/index.php b/sections/reportsv2/index.php index dd2e005d..72c67441 100644 --- a/sections/reportsv2/index.php +++ b/sections/reportsv2/index.php @@ -6,51 +6,54 @@ enforce_login(); -include('array.php'); +include(SERVER_ROOT.'/sections/reportsv2/array.php'); if (isset($_REQUEST['action'])) { switch ($_REQUEST['action']) { case 'report': - include('report.php'); + include(SERVER_ROOT.'/sections/reportsv2/report.php'); break; case 'takereport': - include('takereport.php'); + include(SERVER_ROOT.'/sections/reportsv2/takereport.php'); break; case 'takeresolve': - include('takeresolve.php'); + include(SERVER_ROOT.'/sections/reportsv2/takeresolve.php'); break; case 'take_pm': - include('take_pm.php'); + include(SERVER_ROOT.'/sections/reportsv2/take_pm.php'); break; case 'search': - include('search.php'); + include(SERVER_ROOT.'/sections/reportsv2/search.php'); break; case 'new': include(SERVER_ROOT.'/sections/reportsv2/reports.php'); break; case 'ajax_new_report': - include('ajax_new_report.php'); + include(SERVER_ROOT.'/sections/reportsv2/ajax_new_report.php'); break; case 'ajax_report': - include('ajax_report.php'); + include(SERVER_ROOT.'/sections/reportsv2/ajax_report.php'); break; case 'ajax_change_resolve': - include('ajax_change_resolve.php'); + include(SERVER_ROOT.'/sections/reportsv2/ajax_change_resolve.php'); break; case 'ajax_take_pm': - include('ajax_take_pm.php'); + include(SERVER_ROOT.'/sections/reportsv2/ajax_take_pm.php'); break; case 'ajax_grab_report': - include('ajax_grab_report.php'); + include(SERVER_ROOT.'/sections/reportsv2/ajax_grab_report.php'); + break; + case 'ajax_giveback_report': + include(SERVER_ROOT.'/sections/reportsv2/ajax_giveback_report.php'); break; case 'ajax_update_comment': - require('ajax_update_comment.php'); + include(SERVER_ROOT.'/sections/reportsv2/ajax_update_comment.php'); break; case 'ajax_update_resolve': - require('ajax_update_resolve.php'); + include(SERVER_ROOT.'/sections/reportsv2/ajax_update_resolve.php'); break; case 'ajax_create_report': - require('ajax_create_report.php'); + include(SERVER_ROOT.'/sections/reportsv2/ajax_create_report.php'); break; } } else { diff --git a/sections/reportsv2/reports.php b/sections/reportsv2/reports.php index b108812f..d8dece34 100644 --- a/sections/reportsv2/reports.php +++ b/sections/reportsv2/reports.php @@ -9,19 +9,17 @@ } View::show_header('Reports V2!', 'reportsv2'); - ?>

    New reports, auto assigned!

    - +
    -
    +
    | | |
    -

    -
    +
    - - + + - | + |
    -
    + +
    -
    - - - - -
    - No new reports! \o/ -
    +
    + No new reports! \o/
    decrement('num_torrent_reportsv2'); ?> -
    - - - - -
    - Report for torrent (deleted) has been automatically resolved. -
    +
    + Report for torrent (deleted) has been automatically resolved.
    -
    -
    +?> +
    + -
    - - - - - - - - - - - -
    - - - -
    Reported torrent: +/* +* Some of these are for takeresolve, namely the ones that aren't inputs, some for the JavaScript. +*/ +?> +
    + + + + + + + + + + +
    + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - +?> + ')?> + + DL + uploaded by Switch + + + - - - + + - + $Images = explode(' ', $Images); + foreach ($Images as $Image) { +?> + Relevant image + + + - - - - + } ?> + + + + - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - + | Multi-resolve + | + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - + + + -
    Reported torrent: - (Deleted) + (Deleted) - - DL - uploaded by -
    + + DL + uploaded by +
    -
    was reported by for the reason:
    +
    was reported by for the reason:
    query(" @@ -354,9 +341,9 @@ $GroupOthers = ($DB->record_count() - 1); if ($GroupOthers > 0) { ?> - + query(" @@ -368,9 +355,9 @@ $UploaderOthers = ($DB->record_count() - 1); if ($UploaderOthers > 0) { ?> - + query(" @@ -388,279 +375,283 @@ $Requests = ($DB->has_results()); if ($Requests > 0) { while (list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) { - ?> -
    - used this torrent to fill this request -
    +?> +
    + used this torrent to fill this request +
    -
    Relevant tracks: - -
    Relevant links: -local_url($Link)) { - $Link = $local_url; - } ?> - - -
    Relevant other torrents: -query(" - SELECT - tg.Name, - tg.ID, - CASE COUNT(ta.GroupID) - WHEN 1 THEN aa.ArtistID - WHEN 0 THEN '0' - ELSE '0' - END AS ArtistID, - CASE COUNT(ta.GroupID) - WHEN 1 THEN aa.Name - WHEN 0 THEN '' - ELSE 'Various Artists' - END AS ArtistName, - tg.Year, - t.Time, - t.Remastered, - t.RemasterTitle, - t.RemasterYear, - t.Media, - t.Format, - t.Encoding, - t.Size, - t.HasCue, - t.HasLog, - t.LogScore, - t.UserID AS UploaderID, - uploader.Username - FROM torrents AS t - LEFT JOIN torrents_group AS tg ON tg.ID = t.GroupID - LEFT JOIN torrents_artists AS ta ON ta.GroupID = tg.ID AND ta.Importance = '1' - LEFT JOIN artists_alias AS aa ON aa.AliasID = ta.AliasID - LEFT JOIN users_main AS uploader ON uploader.ID = t.UserID - WHERE t.ID = '$ExtraID' - GROUP BY tg.ID"); - - list($ExtraGroupName, $ExtraGroupID, $ExtraArtistID, $ExtraArtistName, $ExtraYear, $ExtraTime, $ExtraRemastered, $ExtraRemasterTitle, - $ExtraRemasterYear, $ExtraMedia, $ExtraFormat, $ExtraEncoding, $ExtraSize, $ExtraHasCue, $ExtraHasLog, $ExtraLogScore, $ExtraUploaderID, $ExtraUploaderName) = Misc::display_array($DB->next_record()); - - if ($ExtraGroupName) { - $ExtraRemasterDisplayString = Reports::format_reports_remaster_info($ExtraRemastered, $ExtraRemasterTitle, $ExtraRemasterYear); - - if ($ArtistID == 0 && empty($ArtistName)) { - $ExtraLinkName = "$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]$ExtraRemasterDisplayString " . ($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; - } elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') { - $ExtraLinkName = "Various Artists - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]$ExtraRemasterDisplayString " . ($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; - } else { - $ExtraLinkName = "$ExtraArtistName - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]$ExtraRemasterDisplayString " . ($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; - } ?> - ')?> - - DL - uploaded by Switch +
    Relevant tracks: + +
    Relevant links: +local_url($Link)) { + $Link = $local_url; + } +?> + + +
    Relevant other torrents: +query(" + SELECT + tg.Name, + tg.ID, + CASE COUNT(ta.GroupID) + WHEN 1 THEN aa.ArtistID + WHEN 0 THEN '0' + ELSE '0' + END AS ArtistID, + CASE COUNT(ta.GroupID) + WHEN 1 THEN aa.Name + WHEN 0 THEN '' + ELSE 'Various Artists' + END AS ArtistName, + tg.Year, + t.Time, + t.Remastered, + t.RemasterTitle, + t.RemasterYear, + t.Media, + t.Format, + t.Encoding, + t.Size, + t.HasCue, + t.HasLog, + t.LogScore, + t.UserID AS UploaderID, + uploader.Username + FROM torrents AS t + LEFT JOIN torrents_group AS tg ON tg.ID = t.GroupID + LEFT JOIN torrents_artists AS ta ON ta.GroupID = tg.ID AND ta.Importance = '1' + LEFT JOIN artists_alias AS aa ON aa.AliasID = ta.AliasID + LEFT JOIN users_main AS uploader ON uploader.ID = t.UserID + WHERE t.ID = '$ExtraID' + GROUP BY tg.ID"); + + list($ExtraGroupName, $ExtraGroupID, $ExtraArtistID, $ExtraArtistName, $ExtraYear, $ExtraTime, $ExtraRemastered, $ExtraRemasterTitle, + $ExtraRemasterYear, $ExtraMedia, $ExtraFormat, $ExtraEncoding, $ExtraSize, $ExtraHasCue, $ExtraHasLog, $ExtraLogScore, $ExtraUploaderID, $ExtraUploaderName) = Misc::display_array($DB->next_record()); + + if ($ExtraGroupName) { + $ExtraRemasterDisplayString = Reports::format_reports_remaster_info($ExtraRemastered, $ExtraRemasterTitle, $ExtraRemasterYear); + + if ($ArtistID == 0 && empty($ArtistName)) { + $ExtraLinkName = "$ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]$ExtraRemasterDisplayString " . ($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; + } elseif ($ArtistID == 0 && $ArtistName == 'Various Artists') { + $ExtraLinkName = "Various Artists - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]$ExtraRemasterDisplayString " . ($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; + } else { + $ExtraLinkName = "$ExtraArtistName - $ExtraGroupName".($ExtraYear ? " ($ExtraYear)" : '')." [$ExtraFormat/$ExtraEncoding/$ExtraMedia]$ExtraRemasterDisplayString " . ($ExtraHasCue == '1' ? ' (Cue)' : '').($ExtraHasLog == '1' ? " (Log: $ExtraLogScore %)" : '').' ('.number_format($ExtraSize / (1024 * 1024), 2).' MB)'; } - } ?> -
    Relevant images: + if ($Images) { +?> +
    Relevant images: - Relevant image - -
    User comment:full_format($UserComment)?>
    User comment:full_format($UserComment)?>
    In progress by: - -
    Report comment: - - -
    - Resolve - -
    In progress by: + +
    Report comment: + + +
    + Resolve + + + + + + + + + + + Warning + - - - - - - - - - Warning - - - - - - -    - - - - -
    - PM - : - - - -
    Extra log message: - /> - Extra staff notes: - -
    - - + + + + + +    + + + + +
    + PM + : + + + +
    Extra log message: + + /> + Extra staff notes: + +
    + + - | + | - | + | - | Multi-resolve - | -
    Resolver: - -
    Resolve time: - -
    Report comments: - -
    Log message: - -
    Resolver: + +
    Resolve time: + +
    Report comments: + +
    Log message: + +
    - -
    + +
    - -
    - - +
    + +
    +
    - + -
    diff --git a/sections/reportsv2/takeresolve.php b/sections/reportsv2/takeresolve.php index f7bee1f6..787a35df 100644 --- a/sections/reportsv2/takeresolve.php +++ b/sections/reportsv2/takeresolve.php @@ -312,7 +312,7 @@ $Cache->delete_value("reports_torrent_$TorrentID"); - //Now we've done everything, update the DB with values + // Now we've done everything, update the DB with values if ($Report) { $DB->query(" UPDATE reportsv2 @@ -323,16 +323,9 @@ WHERE ID = $ReportID"); } } else { - //Someone beat us to it. Inform the staffer. + // Someone beat us to it. Inform the staffer. ?> - - - - -
    - Somebody has already resolved this report - -
    +Somebody has already resolved this report + diff --git a/sections/reportsv2/views.php b/sections/reportsv2/views.php index 625953c0..351e79f1 100644 --- a/sections/reportsv2/views.php +++ b/sections/reportsv2/views.php @@ -26,9 +26,8 @@

    Reports v2 Information!

    -
    -
    - -
    +
    +
    query(" SELECT @@ -43,10 +42,10 @@ $Results = $DB->to_array(); ?>

    Reports resolved in the last 24 hours

    - - - - +
    UsernameReports
    + + +
    UsernameReports
    -
    query(" SELECT @@ -72,10 +70,10 @@ $Results = $DB->to_array(); ?>

    Reports resolved in the last week

    - - - - +
    UsernameReports
    + + +
    UsernameReports
    -
    query(" SELECT @@ -101,10 +98,10 @@ $Results = $DB->to_array(); ?>

    Reports resolved in the last month

    - - - - +
    UsernameReports
    + + +
    UsernameReports
    -
    query(" SELECT @@ -129,10 +125,10 @@ $Results = $DB->to_array(); ?>

    Reports resolved since Reports v2 (2009-07-27)

    - - - - +
    UsernameReports
    + + +
    UsernameReports
    -

    Different view modes by person

    -
    - By ID of torrent reported: - -
    - By group ID of torrent reported: - -
    - By report ID: - -
    - By reporter ID: - -
    - By uploader ID: - -
    - By resolver ID: - -

    - For browsing anything more complicated than these, use the search feature. -
    +
    + By ID of torrent reported: + + By group ID of torrent reported: + + By report ID: + + By reporter ID: + + By uploader ID: + + By resolver ID: + + For browsing anything more complicated than these, use the search feature. +
    + +
    query(" SELECT @@ -223,10 +213,10 @@ $Staff = $DB->to_array(); ?>

    Currently assigned reports by staff member

    - +
    - - + + @@ -239,7 +229,6 @@
    Staff MemberCurrent CountStaff MemberCurrent Count
    -

    Different view modes by report type

    query(" @@ -252,10 +241,10 @@ $Current = $DB->to_array(); if (!empty($Current)) { ?> - +
    - - + +
    TypeCurrent CountTypeCurrent Count
    -
    +
    '; -if (($Blocks = file("GeoLiteCity_".date('Ym')."06/GeoLiteCity-Blocks.csv", FILE_IGNORE_NEW_LINES)) === false) { +if (($Blocks = file("GeoLiteCity_".date('Ym')."01/GeoLiteCity-Blocks.csv", FILE_IGNORE_NEW_LINES)) === false) { echo 'Error'; } array_shift($Blocks); diff --git a/sections/top10/lastfm.php b/sections/top10/lastfm.php index b5757696..851b9ffa 100644 --- a/sections/top10/lastfm.php +++ b/sections/top10/lastfm.php @@ -12,7 +12,6 @@ $View = in_array($View, array('tiles', 'list')) ? $View : 'tiles'; switch ($Category) { - case 'weekly': $Artists = json_decode(LastFM::get_weekly_artists(LIMIT), true)['artists']['artist']; break; @@ -28,14 +27,15 @@

    Last.fm

    - +
    - - + +
      -
    @@ -43,7 +43,8 @@
      -
    diff --git a/sections/torrents/delete.php b/sections/torrents/delete.php index e7bb60ae..bc455c54 100644 --- a/sections/torrents/delete.php +++ b/sections/torrents/delete.php @@ -46,8 +46,8 @@ View::show_header('Delete torrent', 'reportsv2'); ?> -
    -
    +
    +
    Delete torrent
    @@ -56,18 +56,21 @@ - Reason: - -   - Extra info: - - +
    + Reason: + +
    +
    + Extra info: + + +
    @@ -151,7 +154,7 @@ $BBName = "[url=artist.php?id=$ArtistID]".$ArtistName."[/url] - [url=torrents.php?id=$GroupID]$GroupName".($Year ? " ($Year)" : '')."[/url] [url=torrents.php?torrentid=$TorrentID][$Format/$Encoding/$Media]{$RemasterDisplayString}[/url] " . ($HasLog ? " [url=torrents.php?action=viewlog&torrentid=$TorrentID&groupid=$GroupID](Log: {$LogScore}%)[/url]" : '').' ('.number_format($Size / (1024 * 1024), 2).' MB)'; } ?> -
    +
    - @@ -172,7 +174,7 @@
    - +
    Torrent: diff --git a/sections/torrents/download.php b/sections/torrents/download.php index ffa0ebe0..45b8f11b 100644 --- a/sections/torrents/download.php +++ b/sections/torrents/download.php @@ -37,7 +37,7 @@ /* uTorrent Remote and various scripts redownload .torrent files periodically. To prevent this retardation from blowing bandwidth etc., let's block it if the .torrent file has been downloaded four times before */ -if (strpos($_SERVER['HTTP_USER_AGENT'], 'BTWebClient') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Python-urllib') !== false) { +if ((strpos($_SERVER['HTTP_USER_AGENT'], 'BTWebClient') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Python-urllib') !== false)) { $DB->query(" SELECT 1 FROM users_downloads diff --git a/static/functions/reportsv2.js b/static/functions/reportsv2.js index 5d1b2ebd..76ca15e2 100644 --- a/static/functions/reportsv2.js +++ b/static/functions/reportsv2.js @@ -1,54 +1,48 @@ function ChangeReportType() { - ajax.post("reportsv2.php?action=ajax_report","reportform", function (response) { - $('#dynamic_form').raw().innerHTML = response; + $.post("reportsv2.php?action=ajax_report", $('#reportform').serialize(), function(response) { + $('#dynamic_form').html(response); }); } function ChangeResolve(reportid) { - ajax.get('reportsv2.php?action=ajax_change_resolve&id=' + reportid + '&type=' + $('#resolve_type' + reportid).raw().value + '&categoryid=' + $('#categoryid' + reportid).raw().value, function (response) { - var x = json.decode(response); - $('#delete' + reportid).raw().checked = (x[0] == '1' ? true : false); - if ($('#uploaderid' + reportid).raw().value == $('#reporterid' + reportid).raw().value) { - $('#warning' + reportid).raw().selectedIndex = 0; - $('#upload' + reportid).raw().checked = false; - } else { - $('#upload' + reportid).raw().checked = (x[1] == '1' ? true : false); - $('#warning' + reportid).raw().selectedIndex = x[2]; - } - $('#update_resolve' + reportid).raw().disabled = false; + var url = 'reportsv2.php?action=ajax_change_resolve&id=' + reportid + + '&type=' + $('#resolve_type' + reportid).val() + + '&categoryid=' + $('#categoryid' + reportid).val(); + $.getJSON(url, function(x) { + $('#delete' + reportid).prop('checked', x[0] == '1'); + if ($('#uploaderid' + reportid).val() == $('#reporterid' + reportid).val()) { + $('#upload' + reportid).prop('checked', false); + $('#warning' + reportid).val('0'); + } else { + $('#upload' + reportid).prop('checked', x[1] == '1'); + $('#warning' + reportid).val(x[2]); } - ); + $('#update_resolve' + reportid).enable(); + }); } function Load(reportid) { - var t = $('#type' + reportid).raw().value; - for (var i = 0; i<$('#resolve_type' + reportid).raw().options.length; i++) { - if ($('#resolve_type' + reportid).raw().options[i].value == t) { - $('#resolve_type' + reportid).raw().selectedIndex = i; - break; + var type = $('#type' + reportid).val(); + $('#resolve_type' + reportid + ' option[value="'+type+'"]').prop('selected', true); + // Can't use ChangeResolve() because we need it to block to do the uploader==reporter part + var url = 'reportsv2.php?action=ajax_change_resolve&id=' + reportid + + '&type=' + $('#resolve_type' + reportid).val() + + '&categoryid=' + $('#categoryid' + reportid).val(); + $.getJSON(url, function(x) { + $('#delete' + reportid).prop('checked', x[0] == '1'); + if ($('#uploaderid' + reportid).val() == $('#reporterid' + reportid).val()) { + $('#upload' + reportid).prop('checked', false); + $('#warning' + reportid).val('0'); + } else { + $('#upload' + reportid).prop('checked', x[1] == '1'); + $('#warning' + reportid).val(x[2]); } - } - //Can't use ChangeResolve() because we need it to block to do the uploader==reporter part - ajax.get('reportsv2.php?action=ajax_change_resolve&id=' + reportid + '&type=' + $('#resolve_type' + reportid).raw().value + '&categoryid=' + $('#categoryid' + reportid).raw().value, function (response) { - var x = json.decode(response); - $('#delete' + reportid).raw().checked = (x[0] == '1' ? true : false); - if ($('#uploaderid' + reportid).raw().value == $('#reporterid' + reportid).raw().value) { - $('#warning' + reportid).raw().selectedIndex = 0; - $('#upload' + reportid).raw().checked = false; - } else { - $('#upload' + reportid).raw().checked = (x[1] == '1' ? true : false); - $('#warning' + reportid).raw().selectedIndex = x[2]; - } - $('#update_resolve' + reportid).raw().disabled = false; - } - ); + $('#update_resolve' + reportid).enable(); + }); } function ErrorBox(reportid, message) { - var div = document.createElement("div"); - div.id = "#error_box"; - div.innerHTML = '
    Message from report ' + reportid + ': ' + message + '\n
    '; - $('#all_reports').raw().insertBefore(div, $('#all_reports').raw().firstChild); + $('#all_reports').prepend('
    Message from report ' + reportid + ': ' + message + '\n
    '); } function HideErrors() { @@ -59,15 +53,15 @@ function HideErrors() { function TakeResolve(reportid) { $('#submit_' + reportid).disable(); - ajax.post("reportsv2.php?action=takeresolve","reportform_" + reportid, function (response) { + $.post("reportsv2.php?action=takeresolve", $('#reportform_' + reportid).serialize(), function(response) { if (response) { ErrorBox(reportid, response); } else { - if ($('#from_delete' + reportid).results()) { - window.location = location.protocol + '//' + location.host + location.pathname + "?id=" + $('#from_delete' + reportid).raw().value; + if ($('#from_delete' + reportid).size()) { + window.location.search = '?id=' + $('#from_delete' + reportid).val(); } else { $('#report' + reportid).remove(); - if ($('#dynamic').raw().checked) { + if ($('#dynamic').prop('checked')) { NewReport(1); } } @@ -76,111 +70,87 @@ function TakeResolve(reportid) { } function NewReport(q, view, id) { - for (var i = 0; i < q; i++) { - var url = "reportsv2.php?action=ajax_new_report"; - if (view) { - url += "&view=" + view; - } - if (id) { - url += "&id=" + id; - } - - ajax.get(url, function (response) { - if (response) { - var div = document.createElement("div"); - div.id = "report"; - div.innerHTML = response; - $('#all_reports').raw().appendChild(div); - var id = $('#newreportid').raw().value; - Load(id); - $('#newreportid').remove(); - if ($('#no_reports').results()) { - $('#all_reports').raw().removeChild($('#no_reports').raw()); - } - } else { - //No new reports at this time - if (!$('#report').results() && !$('#no_reports').results()) { - var div = document.createElement("div"); - div.id = "no_reports"; - div.innerHTML = '
    No new reports! \\o/
    '; - $('#all_reports').raw().appendChild(div); + var url = 'reportsv2.php?action=ajax_new_report&uniqurl=' + q; + if (view) { + url += '&view=' + view; + } + if (id) { + url += '&id=' + id; + } + $.get(url, function (response) { + if (response) { + var div = $(response); + var id = div.data("reportid"); + if (!$('#report'+id).size()) { + $('#all_reports').append(div); + $('#no_reports').remove(); + if ($('#type', div).size()) { + Load(id); } } - }); - } -} - -function AddMore(view, id) { - //Function will add the amount of reports in the input box unless that will take it over 50 - var x = 10; - var a = $('#repop_amount').raw().value; - if (a) { - if (!isNaN(a) && a <= 50) { - x = a; - } - } - - if (document.getElementsByName("reportid").length + x <= 50) { - NewReport(x, view, id); - } else { - NewReport(50 - document.getElementsByName("reportid").length, view, id); - } -} - -function SendPM(reportid) { - ajax.post("reportsv2.php?action=ajax_take_pm", "reportform_" + reportid, function (response) { - if (response) { - $('#uploader_pm' + reportid).raw().value = response; } else { - $('#uploader_pm' + reportid).raw().value = ""; + // No new reports at this time + if (!$('.report').size() && !$('#no_reports') == 0) { + $('#all_reports').append($('
    No new reports! \o/
    ')); + } + } + if (--q > 0) { + // Recursion to avoid grabbing the same report multiple times + NewReport(q, view, id); } }); } +function AddMore(view, id) { + // Function will add the amount of reports in the input box unless that will take it over 50 + var num = parseInt($('#repop_amount').val()) || 10; + var curCount = $('.report').size(); + if (curCount < 50) { + NewReport(Math.min(num, 50 - curCount), view, id) + } +} + +function SendPM(reportid) { + $.post('reportsv2.php?action=ajax_take_pm', $('#reportform_' + reportid).serialize(), function(response) { + $('#uploader_pm' + reportid).val(response); + }); +} + function UpdateComment(reportid) { - ajax.post("reportsv2.php?action=ajax_update_comment", "reportform_" + reportid, function (response) { + $.post('reportsv2.php?action=ajax_update_comment', $('#reportform_' + reportid).serialize(), function(response) { if (response) { alert(response); } }); } -function GiveBack(id) { - if (!id) { - var x = document.getElementsByName("reportid"); - for (i = 0; i < x.length; i++) { - /*ajax.get("ajax.php?action=giveback_report&id=" + x[i].value, function (response) { - if (response) { - alert(response); - } - });*/ - $('#report' + x[i].value).remove(); - } - } else { - ajax.get("ajax.php?action=giveback_report&id=" + id, function (response) { +function GiveBack(reportid) { + if (reportid) { + $.get("reportsv2.php?action=ajax_giveback_report&id=" + reportid, function(response) { if (response) { alert(response); } }); - $('#report' + id).remove(); + $('#report' + reportid).remove(); + } else { + $('#all_reports input[name="reportid"]').each(function() { + $.get("reportsv2.php?action=ajax_giveback_report&id=" + this.value, function(response) { + if (response) { + alert(response); + } + }); + $('#report' + this.value).remove(); + }); } } function ManualResolve(reportid) { - var option = document.createElement("OPTION"); - option.value = "manual"; - option.text = "Manual Resolve"; - $('#resolve_type' + reportid).raw().options.add(option); - $('#resolve_type' + reportid).raw().selectedIndex = $('#resolve_type' + reportid).raw().options.length - 1; + $('#resolve_type' + reportid).append('').val('manual'); TakeResolve(reportid); } function Dismiss(reportid) { - var option = document.createElement("OPTION"); - option.value = "dismiss"; - option.text = "Invalid Report"; - $('#resolve_type' + reportid).raw().options.add(option); - $('#resolve_type' + reportid).raw().selectedIndex = $('#resolve_type' + reportid).raw().options.length - 1; + $('#resolve_type' + reportid).append('').val('dismiss'); TakeResolve(reportid); } @@ -190,56 +160,57 @@ function ClearReport(reportid) { function Grab(reportid) { if (reportid) { - ajax.get("reportsv2.php?action=ajax_grab_report&id=" + reportid, function (response) { + $.get("reportsv2.php?action=ajax_grab_report&id=" + reportid, function(response) { if (response == '1') { - $('#grab' + reportid).raw().disabled = true; + $('#grab' + reportid).disable(); } else { alert('Grab failed for some reason :/'); } }); } else { - var x = document.getElementsByName("reportid"); - for (i = 0; i < x.length; i++) { - ajax.get("reportsv2.php?action=ajax_grab_report&id=" + x[i].value, function (response) { - if (response != '1') { + $('#all_reports input[name="reportid"]').each(function() { + var reportid = this.value + $.get("reportsv2.php?action=ajax_grab_report&id=" + reportid, function(response) { + if (response == '1') { + $('#grab' + reportid).disable(); + } else { alert("One of those grabs failed, sorry I can't be more useful :P"); } }); - $('#grab' + x[i].value).raw().disabled = true; - } + }); } } function MultiResolve() { - var multi = document.getElementsByName('multi'); - for (var j = 0; j < multi.length; j++) { - if (multi[j].checked) { - TakeResolve(multi[j].id.substring(5)); - } - } - + $('input[name="multi"]:checked').each(function() { + TakeResolve(this.id.substr(5)) + }); } function UpdateResolve(reportid) { - var newresolve = $('#resolve_type' + reportid).raw().options[$('#resolve_type' + reportid).raw().selectedIndex].value; - ajax.get("reportsv2.php?action=ajax_update_resolve&reportid=" + reportid + "&newresolve=" + newresolve + "&categoryid=" + $('#categoryid' + reportid).raw().value, function (response) { - $('#update_resolve' + reportid).raw().disabled = true; + var newresolve = $('#resolve_type' + reportid).val(); + var url = 'reportsv2.php?action=ajax_update_resolve&reportid=' + reportid + + "&newresolve=" + newresolve + + "&categoryid=" + $('#categoryid' + reportid).val(); + $.get(url, function(response) { + $('#update_resolve' + reportid).disable(); }); } function Switch(reportid, torrentid, otherid) { - //We want to switch positions of the reported torrent - //This entails invalidating the current report and creating a new with the correct preset. + // We want to switch positions of the reported torrent + // This entails invalidating the current report and creating a new with the correct preset. Dismiss(reportid); - var report = new Array(); - report['auth'] = authkey; - report['torrentid'] = otherid - report['type'] = $('#type' + reportid).raw().value; - report['otherid'] = torrentid + var report = { + auth: authkey, + torrentid: otherid, + type: $('#type' + reportid).val(), + otherid: torrentid + } - ajax.post('reportsv2.php?action=ajax_create_report', report, function (response) { + $.post('reportsv2.php?action=ajax_create_report', report, function(response) { //Returns new report ID. if (isNaN(response)) { alert(response); diff --git a/static/styles/anorex/style.css b/static/styles/anorex/style.css index b9e9bb7f..68762464 100644 --- a/static/styles/anorex/style.css +++ b/static/styles/anorex/style.css @@ -366,6 +366,7 @@ p.min_padding { font-size: 8pt; background-color: #DCB881; border: 1px solid #65430F; + margin-bottom: 10px; } .box2 { @@ -382,12 +383,7 @@ p.min_padding { .sidebar { float: right; - width: 250px; - height: 100%; -} - -.sidebar .box { - margin: 0px 5px 10px 5px; + width: 245px; } #AddArtists input { @@ -406,11 +402,10 @@ p.min_padding { } .main_column { - margin: 0px 255px 10px 0px; - width: 590px; + width: 592px; } -.main_column .box, .main_column table { +.main_column table { margin-bottom: 10px; } @@ -863,6 +858,6 @@ div[class~=tooltipster-content] > a { font-weight: normal; } -.reportsv2_views_container { +.reportsv2_views_table { width: 100%; } diff --git a/static/styles/dark_ambient/style.css b/static/styles/dark_ambient/style.css index 22e4ef52..34f36565 100644 --- a/static/styles/dark_ambient/style.css +++ b/static/styles/dark_ambient/style.css @@ -2044,3 +2044,17 @@ div[class~=tooltipster-base] { div[class~=tooltipster-content] > a { color: #007DC6; } + +/* +Consistent .box and .pad +TODO: Make these rules apply globally and add exceptions where needed +*/ +#reportsv2 .box { + background-color: #212121; + border: 1px solid #1a1a1a; + margin: 0 0 20px 0; +} + +#reportsv2 .pad { + padding: 10px !important; +} diff --git a/static/styles/global.css b/static/styles/global.css index 3cf82ad6..50ab8e38 100644 --- a/static/styles/global.css +++ b/static/styles/global.css @@ -629,3 +629,23 @@ tr.torrent .bookmark>a:after { margin-right: auto; padding: 10px 20px 20px 20px; } + +.noborder { + border: none; +} + +.two_columns { + float: left; + width: 50%; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; +} + +.field_div { + margin-bottom: 10px; +} + +.field_div:last-of-type { + margin-bottom: 0; +} diff --git a/static/styles/kuro/style.css b/static/styles/kuro/style.css index f4daf588..78fceff5 100644 --- a/static/styles/kuro/style.css +++ b/static/styles/kuro/style.css @@ -476,10 +476,6 @@ p.min_padding { } .sidebar .pad { - padding: 4px; -} - -#index .sidebar .pad { padding: 9px; } @@ -491,6 +487,7 @@ p.min_padding { font-size: 8pt; background-color: #282828; border: 1px solid #303030; + margin-bottom: 10px; } .box2 { @@ -507,12 +504,7 @@ p.min_padding { .sidebar { float: right; - width: 250px; - height: 100%; -} - -.sidebar .box { - margin: 0px 5px 10px 5px; + width: 245px; } .head { @@ -527,11 +519,10 @@ p.min_padding { } .main_column { - margin: 0px 255px 10px 0px; - width: 590px; + width: 592px; } -.main_column .box,.main_column table { +.main_column table { margin-bottom: 10px; } @@ -939,6 +930,6 @@ tr.torrent .bookmark > a:after { color:#999; } color: red; } -.reportsv2_views_container { +.reportsv2_views_table { width: 100%; } diff --git a/static/styles/layer_cake/style.css b/static/styles/layer_cake/style.css index e670e1ad..fa1c4a8b 100644 --- a/static/styles/layer_cake/style.css +++ b/static/styles/layer_cake/style.css @@ -374,6 +374,7 @@ p.min_padding { font-size: 8pt; background-color: #EAEAEA; border: 1px solid #666666; + margin-bottom: 10px; } .box2 { @@ -390,12 +391,7 @@ p.min_padding { .sidebar { float: right; - width: 250px; - height: 100%; -} - -.sidebar .box { - margin: 0px 5px 10px 5px; + width: 245px; } .head { @@ -410,11 +406,10 @@ p.min_padding { } .main_column { - margin: 0px 255px 10px 0px; - width: 590px; + width: 592px; } -.main_column .box, .main_column table { +.main_column table { margin-bottom: 10px; } @@ -816,6 +811,6 @@ div[class~=tooltipster-content] > a { color: red; } -.reportsv2_views_container { +.reportsv2_views_table { width: 100%; } diff --git a/static/styles/mono/style.css b/static/styles/mono/style.css index 5cb192b2..ad72a616 100644 --- a/static/styles/mono/style.css +++ b/static/styles/mono/style.css @@ -1376,3 +1376,10 @@ table[width="100%"].user_options { width: 400px; max-width: 100%; } + +/* +Consistent .box and .pad +TODO: Make these rules apply globally and add exceptions where needed +*/ +#reportsv2 .pad { padding: 10px !important; } +#reportsv2 .box { margin-bottom: 10px; background-color: rgb(255,255,255); border: 1px solid #aaa; color: #777; } diff --git a/static/styles/postmod/style.css b/static/styles/postmod/style.css index 8a1ec852..be14a158 100644 --- a/static/styles/postmod/style.css +++ b/static/styles/postmod/style.css @@ -523,6 +523,7 @@ p.min_padding { .box { font-size: 10pt; background-color: #F7F6F2; + margin-bottom: 10px; } .box2 { @@ -538,12 +539,7 @@ p.min_padding { .sidebar { float: right; - width: 250px; - height: 100%; -} - -.sidebar .box { - margin: 0px 5px 10px 5px; + width: 245px; } .body { @@ -551,11 +547,10 @@ p.min_padding { } .main_column { - margin: 0px 255px 10px 0px; - width: 590px; + width: 592px; } -.main_column .box, .main_column table { +.main_column table { margin-bottom: 10px; } diff --git a/static/styles/proton/style.css b/static/styles/proton/style.css index 1e7a8cf1..7a7bd439 100644 --- a/static/styles/proton/style.css +++ b/static/styles/proton/style.css @@ -2065,3 +2065,24 @@ div[class~=tooltipster-base] { background-color: #F5F5F5; color: #575757; } + +.reportsv2_views_table { + width: 90%; +} + +/* +Consistent .box and .pad +TODO: Make these rules apply globally and add exceptions where needed +*/ +#reportsv2 .box { + background-color: #f5f5f5; + border: 1px solid #dcdcdc; + margin: 0 0 20px 0; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; +} + +#reportsv2 .pad { + padding: 10px !important; +} diff --git a/static/styles/white.cd/style.css b/static/styles/white.cd/style.css index 6ca47601..b085e59f 100644 --- a/static/styles/white.cd/style.css +++ b/static/styles/white.cd/style.css @@ -826,6 +826,10 @@ div[class~=tooltipster-base] { margin-left: 0; } -.reportsv2_views_container { - width: 90%; +.two_columns:first-of-type { + padding-right: 7px; +} + +.two_columns:last-of-type { + padding-left: 7px; }