summaryrefslogtreecommitdiff
path: root/actions/deletenotice.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-01-24 19:38:40 +0100
committerEvan Prodromou <evan@controlyourself.ca>2009-01-24 19:38:40 +0100
commit0d34cd24abc0329aae7d408b3bab3d692caaa045 (patch)
treeff0751391eeb3023d4a9eda4168c30b596449255 /actions/deletenotice.php
parent1f4edd70cbe28783784c41eda6c93008bbf86a78 (diff)
Update notice deletion
Changed the errors in notice deletion so it now works. Also, consistently delete records from related tables that refer to the notice.
Diffstat (limited to 'actions/deletenotice.php')
-rw-r--r--actions/deletenotice.php40
1 files changed, 10 insertions, 30 deletions
diff --git a/actions/deletenotice.php b/actions/deletenotice.php
index d8bc5d0e0..d4b8e50e5 100644
--- a/actions/deletenotice.php
+++ b/actions/deletenotice.php
@@ -111,15 +111,8 @@ class DeletenoticeAction extends DeleteAction
$this->elementStart('p');
$this->element('span', array('id' => 'confirmation_text'),
_('Are you sure you want to delete this notice?'));
-
- $this->element('input', array('id' => 'submit_no',
- 'name' => 'submit',
- 'type' => 'submit',
- 'value' => _('No')));
- $this->element('input', array('id' => 'submit_yes',
- 'name' => 'submit',
- 'type' => 'submit',
- 'value' => _('Yes')));
+ $this->submit('yes', _('Yes'));
+ $this->submit('no', _('No'));
$this->elementEnd('p');
$this->elementEnd('form');
}
@@ -135,31 +128,18 @@ class DeletenoticeAction extends DeleteAction
return;
}
- $url = common_get_returnto();
- $confirmed = $this->trimmed('submit');
-
- if ($confirmed == _('Yes')) {
-
- $replies = new Reply;
- $replies->get('notice_id', $this->notice->id);
-
- common_dequeue_notice($this->notice);
-
- if (common_config('memcached', 'enabled')) {
- $notice->blowSubsCache();
- }
-
- $replies->delete();
+ if ($this->arg('yes')) {
$this->notice->delete();
+ }
- } else {
+ $url = common_get_returnto();
- if ($url) {
- common_set_returnto(null);
- } else {
- $url = common_local_url('public');
- }
+ if ($url) {
+ common_set_returnto(null);
+ } else {
+ $url = common_local_url('public');
}
+
common_redirect($url);
}
}