diff options
Diffstat (limited to 'mod/reportedcontent')
22 files changed, 473 insertions, 445 deletions
diff --git a/mod/reportedcontent/actions/add.php b/mod/reportedcontent/actions/add.php deleted file mode 100644 index 80f67eab4..000000000 --- a/mod/reportedcontent/actions/add.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - - /** - * Elgg report action - * - * @package ElggReportContent - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - $title = get_input('title'); - $description = get_input('description'); - $address = get_input('address'); - $access = ACCESS_PRIVATE; //this is private and only admins can see it - - if ($title && $address) { - - $report = new ElggObject; - $report->subtype = "reported_content"; - $report->owner_guid = $_SESSION['user']->getGUID(); - $report->title = $title; - $report->address = $address; - $report->description = $description; - $report->access_id = $access; - - if ($report->save()) { - if (!trigger_plugin_hook('reportedcontent:add', 'system', array('report'=>$report), true)) { - $report->delete(); - register_error(elgg_echo('reportedcontent:failed')); - } else { - system_message(elgg_echo('reportedcontent:success')); - $report->state = "active"; - } - forward($address); - } else { - register_error(elgg_echo('reportedcontent:failed')); - forward($address); - } - - } else { - - register_error(elgg_echo('reportedcontent:failed')); - forward($address); - - } - -?>
\ No newline at end of file diff --git a/mod/reportedcontent/actions/archive.php b/mod/reportedcontent/actions/archive.php deleted file mode 100644 index ca4ad2c41..000000000 --- a/mod/reportedcontent/actions/archive.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - - /** - * Elgg reported content: archive action - * - * @package ElggReportedContent - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @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 - $report = get_entity($guid); - if ($report->getSubtype() == "reported_content" && $report->canEdit()) { - - // change the state - if (!trigger_plugin_hook('reportedcontent:archive', 'system', array('report'=>$report), true)) { - system_message(elgg_echo("reportedcontent:notarchived")); - forward("pg/reportedcontent/"); - } - $report->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 deleted file mode 100644 index b2e9c7acd..000000000 --- a/mod/reportedcontent/actions/delete.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php - - /** - * Elgg reported content: delete action - * - * @package ElggReportedCOntent - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @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 - $report = get_entity($guid); - if ($report->getSubtype() == "reported_content" && $report->canEdit()) { - - // Delete it! - if (!trigger_plugin_hook('reportedcontent:delete', '$system', array('report'=>$report), true)) { - register_error(elgg_echo("reportedcontent:notdeleted")); - forward("pg/reportedcontent/"); - } - $rowsaffected = $report->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/actions/reportedcontent/add.php b/mod/reportedcontent/actions/reportedcontent/add.php new file mode 100644 index 000000000..f0a1b05c8 --- /dev/null +++ b/mod/reportedcontent/actions/reportedcontent/add.php @@ -0,0 +1,39 @@ +<?php +/** + * Elgg report action + * + * @package ElggReportContent + */ +$title = get_input('title'); +$description = get_input('description'); +$address = get_input('address'); +$access = ACCESS_PRIVATE; //this is private and only admins can see it + +if ($title && $address) { + + $report = new ElggObject; + $report->subtype = "reported_content"; + $report->owner_guid = elgg_get_logged_in_user_guid(); + $report->title = $title; + $report->address = $address; + $report->description = $description; + $report->access_id = $access; + + if ($report->save()) { + if (!elgg_trigger_plugin_hook('reportedcontent:add', 'system', array('report' => $report), true)) { + $report->delete(); + register_error(elgg_echo('reportedcontent:failed')); + } else { + system_message(elgg_echo('reportedcontent:success')); + $report->state = "active"; + } + forward($address); + } else { + register_error(elgg_echo('reportedcontent:failed')); + forward($address); + } +} else { + + register_error(elgg_echo('reportedcontent:failed')); + forward($address); +} diff --git a/mod/reportedcontent/actions/reportedcontent/archive.php b/mod/reportedcontent/actions/reportedcontent/archive.php new file mode 100644 index 000000000..dd5c6aef1 --- /dev/null +++ b/mod/reportedcontent/actions/reportedcontent/archive.php @@ -0,0 +1,27 @@ +<?php +/** + * Elgg reported content: archive action + * + * @package ElggReportedContent + */ + +$guid = (int) get_input('guid'); + +$report = get_entity($guid); + +// Make sure we actually have permission to edit +if ($report->getSubtype() == "reported_content" && $report->canEdit()) { + + // allow another plugin to override + if (!elgg_trigger_plugin_hook('reportedcontent:archive', 'system', array('report' => $report), TRUE)) { + system_message(elgg_echo("reportedcontent:notarchived")); + forward(REFERER); + } + + // change the state + $report->state = "archived"; + + system_message(elgg_echo("reportedcontent:archived")); + + forward(REFERER); +} diff --git a/mod/reportedcontent/actions/reportedcontent/delete.php b/mod/reportedcontent/actions/reportedcontent/delete.php new file mode 100644 index 000000000..f7d4e2107 --- /dev/null +++ b/mod/reportedcontent/actions/reportedcontent/delete.php @@ -0,0 +1,28 @@ +<?php +/** + * Elgg reported content: delete action + * + * @package ElggReportedContent + */ + +$guid = (int) get_input('guid'); + +$report = get_entity($guid); + +// Make sure we actually have permission to delete +if ($report->getSubtype() == "reported_content" && $report->canEdit()) { + + // give another plugin a chance to override + if (!elgg_trigger_plugin_hook('reportedcontent:delete', 'system', array('report' => $report), TRUE)) { + register_error(elgg_echo("reportedcontent:notdeleted")); + forward(REFERER); + } + + if ($report->delete()) { + system_message(elgg_echo("reportedcontent:deleted")); + } else { + register_error(elgg_echo("reportedcontent:notdeleted")); + } + + forward(REFERER); +} diff --git a/mod/reportedcontent/add.php b/mod/reportedcontent/add.php deleted file mode 100644 index 17076df01..000000000 --- a/mod/reportedcontent/add.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php -/** - * 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 <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - -// 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'); -$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 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/index.php b/mod/reportedcontent/index.php deleted file mode 100644 index 3f3a4c5fe..000000000 --- a/mod/reportedcontent/index.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -/** - * Elgg Reported content - * - * @package ElggReportedContent - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - -require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - -admin_gatekeeper(); -set_context('admin'); -// Set admin user for user block -set_page_owner($_SESSION['guid']); - - -$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)); - -// Display main admin menu -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 6da0b2ba0..c2e197879 100644 --- a/mod/reportedcontent/languages/en.php +++ b/mod/reportedcontent/languages/en.php @@ -1,47 +1,44 @@ <?php - /** - * Elgg reported content plugin language pack - * - * @package ElggReportedContent - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +/** + * Elgg reported content plugin language pack + * + * @package ElggReportedContent + */ - $english = array( - - /** - * Menu items and titles - */ - - 'item:object:reported_content' => 'Reported items', - 'reportedcontent' => 'Reported content', - 'reportedcontent:this' => 'Report this', - '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', - 'reportedcontent:areyousure' => 'Are you sure you want to delete?', - 'reportedcontent:archive' => 'Archive', - '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:reason' => 'Reason for report', - 'reportedcontent:description' => 'Why are you reporting this?', - 'reportedcontent:address' => 'Location of the item', - 'reportedcontent:success' => 'Your report has been sent to the site admin', - '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', - ); - - add_translation("en",$english); -?>
\ No newline at end of file +$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', + '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 report', + 'reportedcontent:areyousure' => 'Are you sure you want to delete?', + 'reportedcontent:archive' => 'Archive report', + 'reportedcontent:archived' => 'The report has been archived', + 'reportedcontent:visit' => 'Visit reported item', + 'reportedcontent:by' => 'Report by', + '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', + 'reportedcontent:success' => 'Your report has been sent to the site admin', + 'reportedcontent:failing' => 'Your report could not be sent', + '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', +); + +add_translation("en", $english); diff --git a/mod/reportedcontent/manifest.xml b/mod/reportedcontent/manifest.xml index 1d127cde3..e96620b01 100644 --- a/mod/reportedcontent/manifest.xml +++ b/mod/reportedcontent/manifest.xml @@ -1,10 +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" /> +<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 e9b86230a..8b18a4d64 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -1,61 +1,103 @@ <?php /** * Elgg Reported content. - * + * * @package ElggReportedContent - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ */ +elgg_register_event_handler('init', 'system', 'reportedcontent_init'); + /** - * Initialise the Reported content and set up the menus. - * + * Initialize the plugin */ function reportedcontent_init() { - global $CONFIG; - + // 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','reportedcontent/css'); - - // Extend context menu and owner_block with report content link - if (isloggedin()) { - elgg_extend_view('profile/menu/links','reportedcontent/user_report'); - } -} + elgg_extend_view('css/elgg', 'reportedcontent/css'); + elgg_extend_view('css/admin', 'reportedcontent/admin_css'); -/** - * Adding the reported content to the admin menu - * - */ -function reportedcontent_pagesetup() { - if (get_context() == 'admin' && isadminloggedin()) { - global $CONFIG; - add_submenu_item(elgg_echo('reportedcontent'), $CONFIG->wwwroot . 'pg/reportedcontent/'); + // 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 + // @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_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'); } /** * Reported content page handler * - * @param array $page Array of page elements, forwarded by the page handling mechanism + * Serves the add report page + * + * @param array $page Array of page routing elements + * @return bool */ function reportedcontent_page_handler($page) { - global $CONFIG; - - // only interested in one page for now - include($CONFIG->pluginspath . "reportedcontent/index.php"); + // only logged in users can report things + gatekeeper(); + + $content .= elgg_view_title(elgg_echo('reportedcontent:this')); + $content .= elgg_view_form('reportedcontent/add'); + $sidebar = elgg_echo('reportedcontent:instructions'); + + $params = array( + 'content' => $content, + 'sidebar' => $sidebar, + ); + $body = elgg_view_layout('one_sidebar', $params); + + echo elgg_view_page(elgg_echo('reportedcontent:this'), $body); + return true; } -// Initialise Reported Content -register_elgg_event_handler('init','system','reportedcontent_init'); -register_elgg_event_handler('pagesetup','system','reportedcontent_pagesetup'); +/** + * 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; + } -//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 + 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/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 new file mode 100644 index 000000000..cc33f54fb --- /dev/null +++ b/mod/reportedcontent/views/default/object/reported_content.php @@ -0,0 +1,84 @@ +<?php +/** + * Elgg reported content object view + * + * @package ElggReportContent + */ + +$report = $vars['entity']; +$reporter = $report->getOwnerEntity(); + +$archive_url = elgg_get_site_url() . "action/reportedcontent/archive?guid=$report->guid"; +$delete_url = elgg_get_site_url() . "action/reportedcontent/delete?guid=$report->guid"; + +//find out if the report is current or archive +if ($report->state == 'archived') { + $reportedcontent_background = "reported-content-archived"; +} else { + $reportedcontent_background = "reported-content-active"; +} + +?> + +<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, + 'is_trusted' => true, + 'class' => 'elgg-button elgg-button-action', + ); + echo elgg_view('output/url', $params); + } + $params = array( + 'href' => $delete_url, + 'text' => elgg_echo('reportedcontent:delete'), + 'is_action' => true, + '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, + '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'), + '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> + </div> +</div> diff --git a/mod/reportedcontent/views/default/reportedcontent/admin_css.php b/mod/reportedcontent/views/default/reportedcontent/admin_css.php new file mode 100644 index 000000000..1ed240f3b --- /dev/null +++ b/mod/reportedcontent/views/default/reportedcontent/admin_css.php @@ -0,0 +1,46 @@ +<?php +/** + * Elgg reported content admin CSS + * + * @package ElggReportContent + */ +?> + +/* REPORTED CONTENT */ +.reported-content { + margin: 5px 0 0; + padding: 5px 7px 3px 9px; + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} +.reported-content p { + margin: 0; +} +.reported-content-active { + border: 1px solid #D3322A; + background: #F7DAD8; +} +.reported-content-archived { + border: 1px solid #666666; + background: #dedede; +} +.reported-content .controls { + float: right; + margin: 5px 0 0 10px; +} +.report-details { + background-color: white; + padding: 5px; + margin-bottom: 5px; + max-width: 500px; + + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} +.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 e01399382..da88ecf70 100644 --- a/mod/reportedcontent/views/default/reportedcontent/css.php +++ b/mod/reportedcontent/views/default/reportedcontent/css.php @@ -1,53 +1,14 @@ <?php /** * Elgg reported content CSS + * + * Footer link CSS * - * @package reportedcontent - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ + * @package ElggReportContent */ ?> -/* link in footer */ -#report_this { - text-align: left; - float:left; +/* Reported Content */ +.elgg-icon-report-this { + background: url(<?php echo elgg_get_site_url(); ?>mod/reportedcontent/graphics/icon_reportthis.gif) no-repeat left top; } -#report_this a { - font-size: 90%; - padding:0 0 4px 20px; - background: url(<?php echo $vars['url']; ?>mod/reportedcontent/graphics/icon_reportthis.gif) no-repeat left top; -} -/* admin area */ -.admin_settings.reported_content { - margin:5px 0 0 0; - padding:5px 7px 3px 9px; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; -} -.admin_settings.reported_content p { - margin:0; -} -.active_report { - border:1px solid #D3322A; - background:#F7DAD8; -} -.archived_report { - border:1px solid #666666; - background:#dedede; -} -.admin_settings.reported_content .controls { - float:right; - margin:14px 5px 0 0; -} -.admin_settings.reported_content a.action_button { - display:inline; - float:right; - margin-left:15px; -} -.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 deleted file mode 100644 index 40561a784..000000000 --- a/mod/reportedcontent/views/default/reportedcontent/form.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php -/** - * 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 <info@elgg.com> - * @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']; - -?> -<form action="<?php echo $vars['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/listing.php b/mod/reportedcontent/views/default/reportedcontent/listing.php deleted file mode 100644 index 99069cb8c..000000000 --- a/mod/reportedcontent/views/default/reportedcontent/listing.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * 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 <info@elgg.com> - * @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 "<div class='admin_settings reported_content {$reportedcontent_background}'>"; - echo "<div class='clearfloat controls'>"; - if($report->state != 'archived') - echo "<a class='action_button' href=\"" . elgg_add_action_tokens_to_url($vars['url'] . "action/reportedcontent/archive?item={$report->guid}") . "\">" . elgg_echo('reportedcontent:archive') . "</a>"; - echo "<a class='action_button disabled' href=\"" . elgg_add_action_tokens_to_url($vars['url'] . "action/reportedcontent/delete?item={$report->guid}") . "\" onclick=\"return confirm('" . elgg_echo('reportedcontent:areyousure') . "')\">" . elgg_echo('reportedcontent:delete') . "</a></div>"; - echo "<p><b>" . elgg_echo('reportedcontent:by') . ": </b><a href=\"{$user_url}\">" . $user . "</a>, " . friendly_time($report->time_created) . "</p>"; - echo "<p><b>" . elgg_echo('reportedcontent:objecttitle') . ": </b>" . $report->title; - echo "<br /><a onclick=\"elgg_slide_toggle(this,'.reported_content','.container{$id}');\" class='details_link'>" . elgg_echo('reportedcontent:moreinfo') . "</a></p>"; - echo "<div class='details container{$id} hidden'>"; - echo "<p><b>" . elgg_echo('reportedcontent:objecturl') . ": </b><a href=\"{$report->address}\">" . elgg_echo('reportedcontent:visit') . "</a></p>"; - echo "<p><b>" . elgg_echo('reportedcontent:reason') . ": </b>" .$report->description . "</p>"; - echo "</div></div>"; - } - -} else { - echo "<p class='margin_top'>".elgg_echo('reportedcontent:none')."</p>"; -}
\ No newline at end of file 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 1b5ff9501..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='". $CONFIG->wwwroot . "mod/reportedcontent/add.php?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> |
