From 41063c981d2484b90b7ea146c02e8e74f2c54119 Mon Sep 17 00:00:00 2001 From: brettp Date: Thu, 4 Mar 2010 03:39:37 +0000 Subject: Merged reported content interface changes. git-svn-id: http://code.elgg.org/elgg/trunk@5271 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/reportedcontent/add.php | 61 +++++----- mod/reportedcontent/graphics/icon_reportthis.gif | Bin 0 -> 570 bytes mod/reportedcontent/index.php | 45 ++++--- mod/reportedcontent/languages/en.php | 8 +- mod/reportedcontent/start.php | 116 +++++++++--------- .../views/default/reportedcontent/css.php | 92 +++++--------- .../views/default/reportedcontent/form.php | 132 ++++++++++----------- .../views/default/reportedcontent/listing.php | 87 +++++++------- .../views/default/reportedcontent/owner_block.php | 9 -- 9 files changed, 244 insertions(+), 306 deletions(-) create mode 100755 mod/reportedcontent/graphics/icon_reportthis.gif delete mode 100644 mod/reportedcontent/views/default/reportedcontent/owner_block.php diff --git a/mod/reportedcontent/add.php b/mod/reportedcontent/add.php index 02892b4eb..4087012cf 100644 --- a/mod/reportedcontent/add.php +++ b/mod/reportedcontent/add.php @@ -1,36 +1,33 @@ + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ - /** - * Elgg reported content send report page - * - * @package ElggReportedContent - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ +// Start engine +require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - // Start engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - - // You need to be logged in for this one - gatekeeper(); - - // Get the current page's owner - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($page_owner->getGUID()); - } - - $area2 .= elgg_view_title(elgg_echo('reportedcontent:this'), false); - - $area2 .= elgg_view('reportedcontent/form'); - - // Format page - $body = elgg_view_layout('two_column_left_sidebar', '', $area2); - - // Draw it - page_draw(elgg_echo('reportedcontent:add'),$body); +// You need to be logged in for this one +gatekeeper(); -?> \ No newline at end of file +// Get the current page's owner +$page_owner = page_owner_entity(); +if ($page_owner === false || is_null($page_owner)) { + $page_owner = $_SESSION['user']; + set_page_owner($page_owner->getGUID()); +} + +$area2 .= elgg_view_title(elgg_echo('reportedcontent:this'), false); +$area2 .= elgg_view('reportedcontent/form'); +$area3 .= elgg_echo('reportedcontent:warning'); + +// Format page +$body = elgg_view_layout('one_column_with_sidebar', '', $area2,$area3); + +// Draw it +page_draw(elgg_echo('reportedcontent:this'),$body); \ No newline at end of file diff --git a/mod/reportedcontent/graphics/icon_reportthis.gif b/mod/reportedcontent/graphics/icon_reportthis.gif new file mode 100755 index 000000000..0590f96e6 Binary files /dev/null and b/mod/reportedcontent/graphics/icon_reportthis.gif differ diff --git a/mod/reportedcontent/index.php b/mod/reportedcontent/index.php index 45c49866b..400e0dc1f 100644 --- a/mod/reportedcontent/index.php +++ b/mod/reportedcontent/index.php @@ -1,32 +1,27 @@ 'object', 'subtypes' => 'reported_content', 'limit' => 9999)); - - $area2 = elgg_view("reportedcontent/listing", array('entity' => $reported)); +$title = elgg_view_title(elgg_echo('reportedcontent')); + +$reported = elgg_get_entities(array('types' => 'object', 'subtypes' => 'reported_content', 'limit' => 9999)); + +$area2 = elgg_view("reportedcontent/listing", array('entity' => $reported)); - if(!$reported) - $reported = elgg_echo("reportedcontent:none"); - // Display main admin menu - page_draw(elgg_echo('reportedcontent'),elgg_view_layout("two_column_left_sidebar", '', $title . $area2)); - -?> \ No newline at end of file +page_draw(elgg_echo('reportedcontent'),elgg_view_layout("one_column_with_sidebar", '', $title . $area2)); \ No newline at end of file diff --git a/mod/reportedcontent/languages/en.php b/mod/reportedcontent/languages/en.php index 00cc73e0e..6da0b2ba0 100644 --- a/mod/reportedcontent/languages/en.php +++ b/mod/reportedcontent/languages/en.php @@ -18,14 +18,14 @@ 'item:object:reported_content' => 'Reported items', 'reportedcontent' => 'Reported content', 'reportedcontent:this' => 'Report this', - 'reportedcontent:none' => 'There is no reported content', + 'reportedcontent:none' => 'There is no reported content at this time.', '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:delete' => 'Delete', 'reportedcontent:areyousure' => 'Are you sure you want to delete?', - 'reportedcontent:archive' => 'Archive it', + 'reportedcontent:archive' => 'Archive', 'reportedcontent:archived' => 'The report has been archived', 'reportedcontent:visit' => 'Visit reported item', 'reportedcontent:by' => 'Report by', @@ -38,7 +38,7 @@ 'reportedcontent:failing' => 'Your report could not be sent', 'reportedcontent:report' => 'Report this', 'reportedcontent:moreinfo' => 'More info', - + 'reportedcontent:warning' => 'Please don\'t abuse the reporting service.', 'reportedcontent:failed' => 'Sorry, the attempt to report this content has failed.', 'reportedcontent:notarchived' => 'We were not able to archive that report', ); diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index d8ee7369e..e9b86230a 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -1,69 +1,61 @@ wwwroot . 'pg/reportedcontent/'); - } - } + // Register a page handler, so we can have nice URLs + register_page_handler('reportedcontent','reportedcontent_page_handler'); - /** - * Reported content page handler - * - * @param array $page Array of page elements, forwarded by the page handling mechanism - */ - function reportedcontent_page_handler($page) - { + // Extend CSS + elgg_extend_view('css','reportedcontent/css'); + + // Extend context menu and owner_block with report content link + if (isloggedin()) { + elgg_extend_view('profile/menu/links','reportedcontent/user_report'); + } +} + +/** + * Adding the reported content to the admin menu + * + */ +function reportedcontent_pagesetup() { + if (get_context() == 'admin' && isadminloggedin()) { global $CONFIG; - - // only interested in one page for now - include($CONFIG->pluginspath . "reportedcontent/index.php"); + add_submenu_item(elgg_echo('reportedcontent'), $CONFIG->wwwroot . 'pg/reportedcontent/'); } +} + +/** + * Reported content page handler + * + * @param array $page Array of page elements, forwarded by the page handling mechanism + */ +function reportedcontent_page_handler($page) { + global $CONFIG; - - - // Initialise Reported Content - register_elgg_event_handler('init','system','reportedcontent_init'); - register_elgg_event_handler('pagesetup','system','reportedcontent_pagesetup'); - - //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 + // only interested in one page for now + include($CONFIG->pluginspath . "reportedcontent/index.php"); +} + +// Initialise Reported Content +register_elgg_event_handler('init','system','reportedcontent_init'); +register_elgg_event_handler('pagesetup','system','reportedcontent_pagesetup'); + +//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 index 061a5e5f6..872ff36bb 100644 --- a/mod/reportedcontent/views/default/reportedcontent/css.php +++ b/mod/reportedcontent/views/default/reportedcontent/css.php @@ -1,43 +1,33 @@ - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ +/** + * Elgg reported content CSS + * + * @package reportedcontent + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ ?> -/* *************************************** -PAGE-OWNER BLOCK -*************************************** */ -#owner_block_report_this { - padding:5px 0 0 0; +/* link in footer */ +#report_this { + text-align: left; + float:left; } -#owner_block_report_this a { +#report_this a { font-size: 90%; - color:#999999; padding:0 0 4px 20px; - background: url(_graphics/icon_reportthis.gif) no-repeat left top; -} -#owner_block_report_this a:hover { - color: #0054a7; + background: url(mod/reportedcontent/graphics/icon_reportthis.gif) no-repeat left top; } - -/* *************************************** - ADMIN AREA - REPORTED CONTENT -*************************************** */ -.reportedcontent_content { +/* admin area */ +.admin_settings.reported_content { margin:0 0 5px 0; - padding:0 7px 4px 10px; + padding:5px 7px 3px 9px; -webkit-border-radius: 5px; -moz-border-radius: 5px; } -.reportedcontent_content p.reportedcontent_detail, -.reportedcontent_content p { +.admin_settings.reported_content p { margin:0; } .active_report { @@ -48,44 +38,16 @@ PAGE-OWNER BLOCK border:1px solid #666666; background:#dedede; } -a.archive_report_button { +.admin_settings.reported_content .controls { float:right; - font: 12px/100% Arial, Helvetica, sans-serif; - font-weight: bold; - color: #ffffff; - background:#4690d6; - border: 1px solid #4690d6; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - width: auto; - padding: 4px; - margin:15px 0 0 20px; - cursor: pointer; -} -a.archive_report_button:hover { - background: #0054a7; - border: 1px solid #0054a7; - text-decoration: none; + margin:14px 5px 0 0; } -a.delete_report_button { +.admin_settings.reported_content a.action_button { + display:inline; float:right; - font: 12px/100% Arial, Helvetica, sans-serif; - font-weight: bold; - color: #ffffff; - background:#999999; - border: 1px solid #999999; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - width: auto; - padding: 4px; - margin:15px 0 0 20px; - cursor: pointer; -} -a.delete_report_button:hover { - background: #333333; - border: 1px solid #333333; - text-decoration:none; + margin-left:15px; } -.reportedcontent_content .collapsible_box { - background: white; +.admin_settings.reported_content .details_link { + cursor: pointer; } + diff --git a/mod/reportedcontent/views/default/reportedcontent/form.php b/mod/reportedcontent/views/default/reportedcontent/form.php index 73fbd5c93..9b8049297 100644 --- a/mod/reportedcontent/views/default/reportedcontent/form.php +++ b/mod/reportedcontent/views/default/reportedcontent/form.php @@ -1,74 +1,72 @@ + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ - /** - * Elgg report content plugin form - * - * @package ElggReportContent - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - $guid = 0; - $title = get_input('title',""); - $description = ""; - $address = get_input('address',""); - if ($address == "previous") - $address = $_SERVER['HTTP_REFERER']; - $tags = array(); - $access_id = ACCESS_PRIVATE; - $shares = array(); - $owner = $vars['user']; +$guid = 0; +$title = get_input('title',""); +$description = ""; +$address = get_input('address',""); +if ($address == "previous") { + $address = $_SERVER['HTTP_REFERER']; +} +$tags = array(); +$access_id = ACCESS_PRIVATE; +$shares = array(); +$owner = $vars['user']; ?> -
-
- - -

-

+ +

+

+ -

-

- +

+

+ -

-

- +

+

+ +

- echo elgg_view('input/longtext',array( - 'internalname' => 'description', - 'value' => $description, - )); - - ?> - -

-

- -

- -
-
+ diff --git a/mod/reportedcontent/views/default/reportedcontent/listing.php b/mod/reportedcontent/views/default/reportedcontent/listing.php index 5d3d3d997..a7ce97797 100644 --- a/mod/reportedcontent/views/default/reportedcontent/listing.php +++ b/mod/reportedcontent/views/default/reportedcontent/listing.php @@ -1,43 +1,46 @@ - "; - - if($vars['entity']){ - - foreach($vars['entity'] as $report){ - - //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 == 'archived'){ - $reportedcontent_background = "archived_report"; - }else{ - $reportedcontent_background = "active_report"; - } - - echo "
"; - echo "

"; - if($report->state != 'archived') { - $url = elgg_add_action_tokens_to_url($vars['url'] . "action/reportedcontent/archive?item=" . $report->guid ); - echo "" . elgg_echo('reportedcontent:archive') . ""; - } - $url = elgg_add_action_tokens_to_url($vars['url'] . "action/reportedcontent/delete?item=" . $report->guid); - echo "" . elgg_echo('reportedcontent:delete') . "

"; - - echo "

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

"; - echo "

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

"; - echo "

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

"; - echo "

" . elgg_echo('reportedcontent:moreinfo') . "

"; - echo "
"; - echo "

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

"; - echo "
"; - - - } - - } - echo ""; -?> +/** + * Elgg report content listing + * + * @package ElggReportContent + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + +if($vars['entity']){ + $id = 0; + foreach($vars['entity'] as $report){ + + // increment our id counter + $id++; + + //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 == 'archived'){ + $reportedcontent_background = "archived_report"; + }else{ + $reportedcontent_background = "active_report"; + } + + echo "
"; + echo ""; + echo "

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

"; + echo "

" . elgg_echo('reportedcontent:objecttitle') . ": " . $report->title; + echo "
" . elgg_echo('reportedcontent:moreinfo') . "

"; + echo "
"; + } + +} else { + echo elgg_echo('reportedcontent:none'); +} \ No newline at end of file diff --git a/mod/reportedcontent/views/default/reportedcontent/owner_block.php b/mod/reportedcontent/views/default/reportedcontent/owner_block.php deleted file mode 100644 index 3624a86d2..000000000 --- a/mod/reportedcontent/views/default/reportedcontent/owner_block.php +++ /dev/null @@ -1,9 +0,0 @@ - -
- -
-- cgit v1.2.3