From e4158cbf4159183b7d9362cf30c7fd5dfb1d877a Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 12 Feb 2011 17:52:18 +0000 Subject: updated reported content to use elgg_view_form git-svn-id: http://code.elgg.org/elgg/trunk@8166 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/reportedcontent/actions/add.php | 39 ------------- mod/reportedcontent/actions/archive.php | 27 --------- mod/reportedcontent/actions/delete.php | 28 --------- .../actions/reportedcontent/add.php | 39 +++++++++++++ .../actions/reportedcontent/archive.php | 27 +++++++++ .../actions/reportedcontent/delete.php | 28 +++++++++ mod/reportedcontent/start.php | 4 +- .../views/default/forms/reportedcontent/add.php | 57 +++++++++++++++++++ .../views/default/reportedcontent/form.php | 66 ---------------------- 9 files changed, 153 insertions(+), 162 deletions(-) delete mode 100644 mod/reportedcontent/actions/add.php delete mode 100644 mod/reportedcontent/actions/archive.php delete mode 100644 mod/reportedcontent/actions/delete.php create mode 100644 mod/reportedcontent/actions/reportedcontent/add.php create mode 100644 mod/reportedcontent/actions/reportedcontent/archive.php create mode 100644 mod/reportedcontent/actions/reportedcontent/delete.php create mode 100644 mod/reportedcontent/views/default/forms/reportedcontent/add.php delete mode 100644 mod/reportedcontent/views/default/reportedcontent/form.php diff --git a/mod/reportedcontent/actions/add.php b/mod/reportedcontent/actions/add.php deleted file mode 100644 index f0a1b05c8..000000000 --- a/mod/reportedcontent/actions/add.php +++ /dev/null @@ -1,39 +0,0 @@ -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/archive.php b/mod/reportedcontent/actions/archive.php deleted file mode 100644 index dd5c6aef1..000000000 --- a/mod/reportedcontent/actions/archive.php +++ /dev/null @@ -1,27 +0,0 @@ -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/delete.php b/mod/reportedcontent/actions/delete.php deleted file mode 100644 index f7d4e2107..000000000 --- a/mod/reportedcontent/actions/delete.php +++ /dev/null @@ -1,28 +0,0 @@ -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/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 @@ +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 @@ +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 @@ +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/start.php b/mod/reportedcontent/start.php index e231216cd..9e5bb813a 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -36,7 +36,7 @@ function reportedcontent_init() { 'admin'); // Register actions - $action_path = elgg_get_plugins_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'); @@ -54,7 +54,7 @@ function reportedcontent_page_handler($page) { gatekeeper(); $content .= elgg_view_title(elgg_echo('reportedcontent:this')); - $content .= elgg_view('reportedcontent/form'); + $content .= elgg_view_form('reportedcontent/add'); $sidebar = elgg_echo('reportedcontent:instructions'); $params = array( 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..abc53e750 --- /dev/null +++ b/mod/reportedcontent/views/default/forms/reportedcontent/add.php @@ -0,0 +1,57 @@ + + +
+ +
+
+ +
+
+ + 'description', + 'value' => $description, + )); + ?> +
+
+ elgg_echo('reportedcontent:report'), + )); + ?> +
diff --git a/mod/reportedcontent/views/default/reportedcontent/form.php b/mod/reportedcontent/views/default/reportedcontent/form.php deleted file mode 100644 index b520d4060..000000000 --- a/mod/reportedcontent/views/default/reportedcontent/form.php +++ /dev/null @@ -1,66 +0,0 @@ - -
- - -
- -
-
- -
-
- - 'description', - 'value' => $description, - )); - - ?> -
-
- -
-
-- cgit v1.2.3