From be55e9428629a17b28e1c03b60640db2b556d49d Mon Sep 17 00:00:00 2001 From: dave Date: Fri, 15 Aug 2008 12:32:29 +0000 Subject: reported content updated git-svn-id: https://code.elgg.org/elgg/trunk@1934 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/reportedcontent/actions/add.php | 1 + mod/reportedcontent/actions/archive.php | 34 ++++++++++++++++++++ mod/reportedcontent/actions/delete.php | 37 ++++++++++++++++++++++ mod/reportedcontent/languages/en.php | 5 ++- mod/reportedcontent/start.php | 2 ++ .../views/default/reportedcontent/css.php | 10 ++++++ .../views/default/reportedcontent/listing.php | 17 ++++++---- 7 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 mod/reportedcontent/actions/archive.php create mode 100644 mod/reportedcontent/actions/delete.php create mode 100644 mod/reportedcontent/views/default/reportedcontent/css.php (limited to 'mod') diff --git a/mod/reportedcontent/actions/add.php b/mod/reportedcontent/actions/add.php index bfb5fcfb3..c37cae466 100644 --- a/mod/reportedcontent/actions/add.php +++ b/mod/reportedcontent/actions/add.php @@ -27,6 +27,7 @@ if ($entity->save()) { system_message(elgg_echo('reportedcontent:success')); + $entity->state = "active"; forward($address); } else { register_error(elgg_echo('reportedcontent:failed')); diff --git a/mod/reportedcontent/actions/archive.php b/mod/reportedcontent/actions/archive.php new file mode 100644 index 000000000..312d05eea --- /dev/null +++ b/mod/reportedcontent/actions/archive.php @@ -0,0 +1,34 @@ + + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + */ + + // Make sure we're logged in and are admin + admin_gatekeeper(); + + // Get input data + $guid = (int) get_input('item'); + + // Make sure we actually have permission to edit + $reported = get_entity($guid); + if ($reported->getSubtype() == "reported_content" && $reported->canEdit()) { + + // change the state + $reported->state = "archived"; + + // Success message + system_message(elgg_echo("reportedcontent:archived")); + + // Forward back to the reported content page + forward("pg/reportedcontent/"); + + } + +?> \ No newline at end of file diff --git a/mod/reportedcontent/actions/delete.php b/mod/reportedcontent/actions/delete.php new file mode 100644 index 000000000..f304a47f2 --- /dev/null +++ b/mod/reportedcontent/actions/delete.php @@ -0,0 +1,37 @@ + + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + */ + + // Make sure we're logged in and are admin + admin_gatekeeper(); + + // Get input data + $guid = (int) get_input('item'); + + // Make sure we actually have permission to edit + $reported = get_entity($guid); + if ($reported->getSubtype() == "reported_content" && $reported->canEdit()) { + + // Delete it! + $rowsaffected = $reported->delete(); + if ($rowsaffected > 0) { + // Success message + system_message(elgg_echo("reportedcontent:deleted")); + } else { + register_error(elgg_echo("reportedcontent:notdeleted")); + } + + // Forward back to the reported content page + forward("pg/reportedcontent/"); + + } + +?> \ No newline at end of file diff --git a/mod/reportedcontent/languages/en.php b/mod/reportedcontent/languages/en.php index c2b336edc..d5d9e8029 100644 --- a/mod/reportedcontent/languages/en.php +++ b/mod/reportedcontent/languages/en.php @@ -15,14 +15,17 @@ * Menu items and titles */ - 'item:object:reported_content' => 'Reported items', 'reportedcontent' => 'Reported content', 'reportedcontent:this' => 'Report this', 'reportedcontent:none' => 'There is no reported content', 'reportedcontent:report' => 'Report to admin', 'reportedcontent:title' => 'Page title', + 'reportedcontent:deleted' => 'The reported content has been deleted', + 'reportedcontent:notdeleted' => 'We were not able to delete that report', 'reportedcontent:delete' => 'Delete it', + 'reportedcontent:areyousure' => 'Are you sure you want to delete?', 'reportedcontent:archive' => 'Archive it', + 'reportedcontent:archived' => 'The report has been archived', 'reportedcontent:visit' => 'Visit reported item', 'reportedcontent:by' => 'Report by', 'reportedcontent:objecttitle' => 'Object title', diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index e8c9614cd..aaee94ce0 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -62,5 +62,7 @@ //register action register_action('reportedcontent/add',false,$CONFIG->pluginspath . "reportedcontent/actions/add.php"); + register_action('reportedcontent/delete',false,$CONFIG->pluginspath . "reportedcontent/actions/delete.php"); + register_action('reportedcontent/archive',false,$CONFIG->pluginspath . "reportedcontent/actions/archive.php"); ?> \ No newline at end of file diff --git a/mod/reportedcontent/views/default/reportedcontent/css.php b/mod/reportedcontent/views/default/reportedcontent/css.php new file mode 100644 index 000000000..c3cdbe098 --- /dev/null +++ b/mod/reportedcontent/views/default/reportedcontent/css.php @@ -0,0 +1,10 @@ +.reported_content { + background:#efefef; + border:1px solid #ccc; + padding:5px; +} + +span.reported_detail { + width:200px; + border-left:1px solid #ccc; +} \ No newline at end of file diff --git a/mod/reportedcontent/views/default/reportedcontent/listing.php b/mod/reportedcontent/views/default/reportedcontent/listing.php index 8a0342ed2..b56a12615 100644 --- a/mod/reportedcontent/views/default/reportedcontent/listing.php +++ b/mod/reportedcontent/views/default/reportedcontent/listing.php @@ -7,18 +7,21 @@ //get the user making the report $user = get_user($report->owner_guid)->name; $user_url = get_user($report->owner_guid)->getURL(); + //find out if the report is current or archive - if($report->state == 'archive') - $reportedcontent_background = "archive"; - else - $reportedcontent_background = "active"; + if($report->state == 'archived'){ + $reportedcontent_background = "archive"; + }else{ + $reportedcontent_background = "active"; + } + echo "
"; echo "

" . elgg_echo('reportedcontent:by') . ": " . $user . ", " . friendly_time($report->time_created) . "

"; echo "

" . elgg_echo('reportedcontent:objecttitle') . ": " . $report->title . "

"; - echo "

[" . elgg_echo('reportedcontent:archive') . "] - [" . elgg_echo('reportedcontent:delete') . "]

"; - echo "

" . elgg_echo("more info") . "

"; - echo "
"; + echo "

[" . elgg_echo('reportedcontent:archive') . "] - [" . elgg_echo('reportedcontent:delete') . "]

"; + echo "

" . elgg_echo("more info") . "

"; + echo "
"; echo "

" . elgg_echo('reportedcontent:objecturl') . ": address}\">" . elgg_echo('reportedcontent:visit') . "

"; echo "

" . elgg_echo('reportedcontent:reason') . ": " .$report->description . "

"; echo "
"; -- cgit v1.2.3