diff options
Diffstat (limited to 'mod/reportedcontent')
18 files changed, 249 insertions, 189 deletions
diff --git a/mod/reportedcontent/actions/add.php b/mod/reportedcontent/actions/reportedcontent/add.php index 7c60cdf22..f0a1b05c8 100644 --- a/mod/reportedcontent/actions/add.php +++ b/mod/reportedcontent/actions/reportedcontent/add.php @@ -13,7 +13,7 @@ if ($title && $address) { $report = new ElggObject; $report->subtype = "reported_content"; - $report->owner_guid = get_loggedin_userid(); + $report->owner_guid = elgg_get_logged_in_user_guid(); $report->title = $title; $report->address = $address; $report->description = $description; diff --git a/mod/reportedcontent/actions/archive.php b/mod/reportedcontent/actions/reportedcontent/archive.php index dd5c6aef1..dd5c6aef1 100644 --- a/mod/reportedcontent/actions/archive.php +++ b/mod/reportedcontent/actions/reportedcontent/archive.php diff --git a/mod/reportedcontent/actions/delete.php b/mod/reportedcontent/actions/reportedcontent/delete.php index f7d4e2107..f7d4e2107 100644 --- a/mod/reportedcontent/actions/delete.php +++ b/mod/reportedcontent/actions/reportedcontent/delete.php diff --git a/mod/reportedcontent/graphics/icon_reportthis.gif b/mod/reportedcontent/graphics/icon_reportthis.gif Binary files differindex 0590f96e6..0590f96e6 100755..100644 --- a/mod/reportedcontent/graphics/icon_reportthis.gif +++ b/mod/reportedcontent/graphics/icon_reportthis.gif diff --git a/mod/reportedcontent/languages/en.php b/mod/reportedcontent/languages/en.php index 8c0755b92..c2e197879 100644 --- a/mod/reportedcontent/languages/en.php +++ b/mod/reportedcontent/languages/en.php @@ -8,6 +8,7 @@ $english = array( 'item:object:reported_content' => 'Reported items', + 'admin:administer_utilities:reportedcontent' => 'Reported content', 'reportedcontent' => 'Reported content', 'reportedcontent:this' => 'Report this', 'reportedcontent:this:tooltip' => 'Report this page to an administrator', @@ -22,8 +23,8 @@ $english = array( 'reportedcontent:archived' => 'The report has been archived', 'reportedcontent:visit' => 'Visit reported item', 'reportedcontent:by' => 'Report by', - 'reportedcontent:objecttitle' => 'Object title', - 'reportedcontent:objecturl' => 'Object url', + 'reportedcontent:objecttitle' => 'Page title', + 'reportedcontent:objecturl' => 'Page url', 'reportedcontent:reason' => 'Reason for report', 'reportedcontent:description' => 'Why are you reporting this?', 'reportedcontent:address' => 'Location of the item', @@ -32,6 +33,9 @@ $english = array( 'reportedcontent:report' => 'Report this', 'reportedcontent:moreinfo' => 'More info', 'reportedcontent:instructions' => 'This report will be sent to the administrators of this site for review.', + 'reportedcontent:numbertodisplay' => 'Number of reports to display', + 'reportedcontent:widget:description' => 'Display reported content', + 'reportedcontent:user' => 'Report user', '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/manifest.xml b/mod/reportedcontent/manifest.xml index e5a34ba99..e96620b01 100644 --- a/mod/reportedcontent/manifest.xml +++ b/mod/reportedcontent/manifest.xml @@ -1,12 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> -<plugin_manifest> - <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> - <field key="description" value="Adds the option for users to report content and for admins to check it out." /> - <field key="website" value="http://www.elgg.org/" /> - <field key="copyright" value="(C) Curverider 2008-2010" /> - <field key="licence" value="GNU Public License version 2" /> - <field key="elgg_version" value="2010030101" /> - <field key="elgg_install_state" value="enabled" /> - <field key="admin_interface" value="advanced" /> +<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8"> + <name>Reported Content</name> + <author>Core developers</author> + <version>1.8</version> + <category>bundled</category> + <description>Adds the option for users to report content and for admins to check it out.</description> + <website>http://www.elgg.org/</website> + <copyright>See COPYRIGHT.txt</copyright> + <license>GNU General Public License version 2</license> + <requires> + <type>elgg_release</type> + <version>1.8</version> + </requires> + <activate_on_install>true</activate_on_install> </plugin_manifest> diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index b947927d9..8b18a4d64 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -5,7 +5,7 @@ * @package ElggReportedContent */ -elgg_register_event_handler('init','system','reportedcontent_init'); +elgg_register_event_handler('init', 'system', 'reportedcontent_init'); /** * Initialize the plugin @@ -13,23 +13,42 @@ elgg_register_event_handler('init','system','reportedcontent_init'); function reportedcontent_init() { // Register a page handler, so we can have nice URLs - register_page_handler('reportedcontent', 'reportedcontent_page_handler'); + elgg_register_page_handler('reportedcontent', 'reportedcontent_page_handler'); // Extend CSS - elgg_extend_view('css/screen', 'reportedcontent/css'); + elgg_extend_view('css/elgg', 'reportedcontent/css'); elgg_extend_view('css/admin', 'reportedcontent/admin_css'); - // Extend context menu and footer with report content link - if (isloggedin()) { - elgg_extend_view('profile/menu/links', 'reportedcontent/user_report'); - elgg_extend_view('footer/links', 'reportedcontent/footer_link'); + // Extend footer with report content link + if (elgg_is_logged_in()) { + $href = "javascript:elgg.forward('reportedcontent/add'"; + $href .= "+'?address='+encodeURIComponent(location.href)"; + $href .= "+'&title='+encodeURIComponent(document.title));"; + + elgg_register_menu_item('footer', array( + 'name' => 'report_this', + 'href' => $href, + 'title' => elgg_echo('reportedcontent:this:tooltip'), + 'text' => elgg_view_icon('report-this') . elgg_echo('reportedcontent:this'), + 'priority' => 500, + 'section' => 'alt', + )); } + elgg_register_plugin_hook_handler('register', 'menu:user_hover', 'reportedcontent_user_hover_menu'); + // Add admin menu item - elgg_add_admin_submenu_item('reportedcontent', elgg_echo('reportedcontent'), 'overview'); + // @todo Might want to move this to a 'feedback' section. something other than utils + elgg_register_admin_menu_item('administer', 'reportedcontent', 'administer_utilities'); + + elgg_register_widget_type( + 'reportedcontent', + elgg_echo('reportedcontent'), + elgg_echo('reportedcontent:widget:description'), + 'admin'); // Register actions - $action_path = elgg_get_plugin_path() . "reportedcontent/actions"; + $action_path = elgg_get_plugins_path() . "reportedcontent/actions/reportedcontent"; elgg_register_action('reportedcontent/add', "$action_path/add.php"); elgg_register_action('reportedcontent/delete', "$action_path/delete.php", 'admin'); elgg_register_action('reportedcontent/archive', "$action_path/archive.php", 'admin'); @@ -41,20 +60,44 @@ function reportedcontent_init() { * Serves the add report page * * @param array $page Array of page routing elements + * @return bool */ function reportedcontent_page_handler($page) { // only logged in users can report things gatekeeper(); $content .= elgg_view_title(elgg_echo('reportedcontent:this')); - $content .= elgg_view('reportedcontent/form'); - $sidebar .= elgg_echo('reportedcontent:instructions'); + $content .= elgg_view_form('reportedcontent/add'); + $sidebar = elgg_echo('reportedcontent:instructions'); $params = array( 'content' => $content, - 'sidebar' => $sidebar + 'sidebar' => $sidebar, ); - $body = elgg_view_layout('one_column_with_sidebar', $params); + $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page(elgg_echo('reportedcontent:this'), $body); + return true; } + +/** + * Add report user link to hover menu + */ +function reportedcontent_user_hover_menu($hook, $type, $return, $params) { + $user = $params['entity']; + + $profile_url = urlencode($user->getURL()); + $name = urlencode($user->name); + $url = "reportedcontent/add?address=$profile_url&title=$name"; + + if (elgg_is_logged_in() && elgg_get_logged_in_user_guid() != $user->guid) { + $item = new ElggMenuItem( + 'reportuser', + elgg_echo('reportedcontent:user'), + $url); + $item->setSection('action'); + $return[] = $item; + } + + return $return; +}
\ No newline at end of file diff --git a/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php b/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php new file mode 100644 index 000000000..ed52a536d --- /dev/null +++ b/mod/reportedcontent/views/default/admin/administer_utilities/reportedcontent.php @@ -0,0 +1,13 @@ +<?php +/** + * Elgg Reported content admin page + * + * @package ElggReportedContent + */ + +$list = elgg_list_entities(array('type' => 'object', 'subtype' => 'reported_content')); +if (!$list) { + $list = '<p class="mtm">' . elgg_echo('reportedcontent:none') . '</p>'; +} + +echo $list;
\ No newline at end of file diff --git a/mod/reportedcontent/views/default/admin/overview/reportedcontent.php b/mod/reportedcontent/views/default/admin/overview/reportedcontent.php deleted file mode 100644 index 3f79d500a..000000000 --- a/mod/reportedcontent/views/default/admin/overview/reportedcontent.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** - * Elgg Reported content admin page - * - * @package ElggReportedContent - */ - -$title = elgg_view_title(elgg_echo('reportedcontent')); - -$list = elgg_list_entities(array('types' => 'object', 'subtypes' => 'reported_content')); -if (!$list) { - $list = '<p class="margin-top">' . elgg_echo('reportedcontent:none') . '</p>'; -} - -$body = <<<__HTML -$title -$list -__HTML; - -echo $body;
\ No newline at end of file diff --git a/mod/reportedcontent/views/default/forms/reportedcontent/add.php b/mod/reportedcontent/views/default/forms/reportedcontent/add.php new file mode 100644 index 000000000..f9986849d --- /dev/null +++ b/mod/reportedcontent/views/default/forms/reportedcontent/add.php @@ -0,0 +1,57 @@ +<?php +/** + * Elgg report content plugin form + * + * @package ElggReportContent + */ + +$guid = 0; +$title = get_input('title', ""); +$address = get_input('address', ""); + +$description = ""; +$owner = elgg_get_logged_in_user_entity(); + +?> + +<div> + <label> + <?php + echo elgg_echo('reportedcontent:title'); + echo elgg_view('input/text', array( + 'name' => 'title', + 'value' => $title, + )); + ?> + </label> +</div> +<div> + <label> + <?php + echo elgg_echo('reportedcontent:address'); + echo elgg_view('input/url', array( + 'name' => 'address', + 'value' => $address, + )); + + ?> + </label> +</div> +<div> + <label> + <?php echo elgg_echo('reportedcontent:description'); ?> + </label> + <?php + echo elgg_view('input/longtext',array( + 'name' => 'description', + 'value' => $description, + )); + ?> +</div> +<div class="elgg-foot"> + <?php + echo elgg_view('input/submit', array( + 'value' => elgg_echo('reportedcontent:report'), + )); + ?> +</div> diff --git a/mod/reportedcontent/views/default/object/reported_content.php b/mod/reportedcontent/views/default/object/reported_content.php index 1c4647cfe..cc33f54fb 100644 --- a/mod/reportedcontent/views/default/object/reported_content.php +++ b/mod/reportedcontent/views/default/object/reported_content.php @@ -13,22 +13,24 @@ $delete_url = elgg_get_site_url() . "action/reportedcontent/delete?guid=$report- //find out if the report is current or archive if ($report->state == 'archived') { - $reportedcontent_background = "archived_report"; + $reportedcontent_background = "reported-content-archived"; } else { - $reportedcontent_background = "active_report"; + $reportedcontent_background = "reported-content-active"; } ?> -<div class="admin_settings reported_content <?php echo $reportedcontent_background; ?>"> - <div class="clearfix controls"> +<div class="reported-content <?php echo $reportedcontent_background; ?>"> + <div class="clearfix"> + <div class="clearfix controls"> <?php if ($report->state != 'archived') { $params = array( 'href' => $archive_url, 'text' => elgg_echo('reportedcontent:archive'), 'is_action' => true, - 'class' => 'action-button', + 'is_trusted' => true, + 'class' => 'elgg-button elgg-button-action', ); echo elgg_view('output/url', $params); } @@ -36,42 +38,45 @@ if ($report->state == 'archived') { 'href' => $delete_url, 'text' => elgg_echo('reportedcontent:delete'), 'is_action' => true, - 'class' => 'action-button disabled', + 'is_trusted' => true, + 'class' => 'elgg-button elgg-button-action', ); echo elgg_view('output/url', $params); ?> - </div> - <p> - <b><?php echo elgg_echo('reportedcontent:by'); ?>:</b> - <?php echo elgg_view('output/url', array( - 'href' => $reporter->getURL(), - 'text' => $reporter->name - )); - ?>, - <?php echo elgg_view_friendly_time($report->time_created); ?> - </p> - <p> - <b><?php echo elgg_echo('reportedcontent:objecttitle'); ?>:</b> - <?php echo $report->title; ?> - <br /> - <?php echo elgg_view('output/url', array( - 'href' => '#', - 'text' => elgg_echo('reportedcontent:moreinfo'), - 'class' => 'details_link', - 'onclick' => "elgg_slide_toggle(this, '.reported_content', '.reported_content_more{$report->getGUID()}'); return false;" - )); - ?> - </p> - <div class="details hidden reported_content_more<?php echo $report->getGUID();?>"> + </div> + <p> + <b><?php echo elgg_echo('reportedcontent:by'); ?>:</b> + <?php echo elgg_view('output/url', array( + 'href' => $reporter->getURL(), + 'text' => $reporter->name, + 'is_trusted' => true, + )); + ?>, + <?php echo elgg_view_friendly_time($report->time_created); ?> + </p> + <p> + <b><?php echo elgg_echo('reportedcontent:objecttitle'); ?>:</b> + <?php echo $report->title; ?> <p> <b><?php echo elgg_echo('reportedcontent:objecturl'); ?>:</b> <?php echo elgg_view('output/url', array( 'href' => $report->address, - 'text' => elgg_echo('reportedcontent:visit') + 'text' => elgg_echo('reportedcontent:visit'), + 'is_trusted' => true, )); ?> </p> <p> + <?php echo elgg_view('output/url', array( + 'href' => "#report-$report->guid", + 'text' => elgg_echo('reportedcontent:moreinfo'), + 'rel' => "toggle", + )); + ?> + </p> + </div> + <div class="report-details hidden" id="report-<?php echo $report->getGUID();?>"> + <p> <b><?php echo elgg_echo('reportedcontent:reason'); ?>:</b> <?php echo $report->description; ?> </p> diff --git a/mod/reportedcontent/views/default/reportedcontent/admin_css.php b/mod/reportedcontent/views/default/reportedcontent/admin_css.php index 82566ff3a..1ed240f3b 100644 --- a/mod/reportedcontent/views/default/reportedcontent/admin_css.php +++ b/mod/reportedcontent/views/default/reportedcontent/admin_css.php @@ -7,32 +7,40 @@ ?> /* REPORTED CONTENT */ -.admin_settings.reported_content { - margin:5px 0 0 0; - padding:5px 7px 3px 9px; +.reported-content { + margin: 5px 0 0; + padding: 5px 7px 3px 9px; + -webkit-border-radius: 5px; -moz-border-radius: 5px; + border-radius: 5px; } -.admin_settings.reported_content p { - margin:0; +.reported-content p { + margin: 0; } -.active_report { - border:1px solid #D3322A; - background:#F7DAD8; +.reported-content-active { + border: 1px solid #D3322A; + background: #F7DAD8; } -.archived_report { - border:1px solid #666666; - background:#dedede; +.reported-content-archived { + border: 1px solid #666666; + background: #dedede; } -.admin_settings.reported_content .controls { - float:right; - margin:14px 5px 0 0; +.reported-content .controls { + float: right; + margin: 5px 0 0 10px; } -.admin_settings.reported_content a.action_button { - display:inline; - float:right; - margin-left:15px; +.report-details { + background-color: white; + padding: 5px; + margin-bottom: 5px; + max-width: 500px; + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; } -.admin_settings.reported_content .details_link { - cursor: pointer; +.elgg-widget-content .reported-content .elgg-button { + display: block; + margin: 5px; } diff --git a/mod/reportedcontent/views/default/reportedcontent/css.php b/mod/reportedcontent/views/default/reportedcontent/css.php index c66cd2004..da88ecf70 100644 --- a/mod/reportedcontent/views/default/reportedcontent/css.php +++ b/mod/reportedcontent/views/default/reportedcontent/css.php @@ -9,12 +9,6 @@ ?> /* Reported Content */ -#report_this { - text-align: left; - float:left; -} -#report_this a { - font-size: 90%; - padding:0 0 4px 20px; +.elgg-icon-report-this { background: url(<?php echo elgg_get_site_url(); ?>mod/reportedcontent/graphics/icon_reportthis.gif) no-repeat left top; } diff --git a/mod/reportedcontent/views/default/reportedcontent/footer_link.php b/mod/reportedcontent/views/default/reportedcontent/footer_link.php deleted file mode 100644 index 69e6f0967..000000000 --- a/mod/reportedcontent/views/default/reportedcontent/footer_link.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php -/** - * Elgg report this link - * - * @package ElggReportContent - */ - -$title = elgg_echo('reportedcontent:this:tooltip'); -$text = elgg_echo('reportedcontent:this'); -?> - -<div id="report_this"> - <a href="javascript:location.href='<?php echo elgg_get_site_url(); ?>pg/reportedcontent/add/?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)" title="<?php echo $title; ?>"><?php echo $text; ?></a> -</div> diff --git a/mod/reportedcontent/views/default/reportedcontent/form.php b/mod/reportedcontent/views/default/reportedcontent/form.php deleted file mode 100644 index e70afacf8..000000000 --- a/mod/reportedcontent/views/default/reportedcontent/form.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php -/** - * Elgg report content plugin form - * - * @package ElggReportContent - */ - -$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 = get_loggedin_user(); - -?> -<form action="<?php echo elgg_get_site_url(); ?>action/reportedcontent/add" method="post" class="margin-top"> -<?php echo elgg_view('input/securitytoken'); ?> - - <p> - <label> - <?php echo elgg_echo('reportedcontent:title'); ?> - <?php - - echo elgg_view('input/text',array( - 'internalname' => 'title', - 'value' => $title, - )); - - ?> - </label> - </p> - <p> - <label> - <?php echo elgg_echo('reportedcontent:address'); ?> - <?php - - echo elgg_view('input/url',array( - 'internalname' => 'address', - 'value' => $address, - )); - - ?> - </label> - </p> - <p class="longtext_inputarea"> - <label> - <?php echo elgg_echo('reportedcontent:description'); ?> - </label> - <?php - - echo elgg_view('input/longtext',array( - 'internalname' => 'description', - 'value' => $description, - )); - - ?> - </p> - <p> - <input type="submit" value="<?php echo elgg_echo('reportedcontent:report'); ?>" /> - </p> - -</form> diff --git a/mod/reportedcontent/views/default/reportedcontent/user_report.php b/mod/reportedcontent/views/default/reportedcontent/user_report.php deleted file mode 100644 index 517e87c86..000000000 --- a/mod/reportedcontent/views/default/reportedcontent/user_report.php +++ /dev/null @@ -1,5 +0,0 @@ -<li class="user_menu_profile"> -<?php - echo "<a class='report_this' href=\"javascript:location.href='". elgg_get_site_url() . "pg/reportedcontent/add/?address='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)\">" . elgg_echo('reportedcontent:report') . "</a>"; -?> -</li>
\ No newline at end of file diff --git a/mod/reportedcontent/views/default/widgets/reportedcontent/content.php b/mod/reportedcontent/views/default/widgets/reportedcontent/content.php new file mode 100644 index 000000000..0095decca --- /dev/null +++ b/mod/reportedcontent/views/default/widgets/reportedcontent/content.php @@ -0,0 +1,16 @@ +<?php +/** + * List the latest reports + */ + +$list = elgg_list_entities(array( + 'type' => 'object', + 'subtype' => 'reported_content', + 'limit' => $vars['entity']->num_display, + 'pagination' => false, +)); +if (!$list) { + $list = '<p class="mtm">' . elgg_echo('reportedcontent:none') . '</p>'; +} + +echo $list;
\ No newline at end of file diff --git a/mod/reportedcontent/views/default/widgets/reportedcontent/edit.php b/mod/reportedcontent/views/default/widgets/reportedcontent/edit.php new file mode 100644 index 000000000..ecd732d23 --- /dev/null +++ b/mod/reportedcontent/views/default/widgets/reportedcontent/edit.php @@ -0,0 +1,22 @@ +<?php +/** + * Widget edit view + */ + +// set default value +if (!isset($vars['entity']->num_display)) { + $vars['entity']->num_display = 4; +} + +$params = array( + 'name' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), +); +$dropdown = elgg_view('input/dropdown', $params); + +?> +<div> + <?php echo elgg_echo('reportedcontent:numbertodisplay'); ?>: + <?php echo $dropdown; ?> +</div> |
