diff --git a/controllers/myplugins.php b/controllers/myplugins.php index e4f87d4091f1fdbce0c44a79c895a85ecb4e56db..ca345e1bee93d412c7ea74f564270ef2a4656a36 100644 --- a/controllers/myplugins.php +++ b/controllers/myplugins.php @@ -167,4 +167,15 @@ class MypluginsController extends MarketController $this->redirect('presenting/details/' . $this->release->plugin->getId()); } + + public function delete_action($plugin_id) { + $this->marketplugin = MarketPlugin::find($plugin_id); + if (Request::submitted('delete') && $this->marketplugin->isWritable()) { + CSRFProtection::verifyUnsafeRequest(); + $this->marketplugin->delete(); + $this->redirect('myplugins/overview'); + } + } + + } \ No newline at end of file diff --git a/controllers/presenting.php b/controllers/presenting.php index c0058cba9fef6cfe485f3016a99949853da087da..867991e6a6e5b12c43c0f920d31cf53a141c0367 100644 --- a/controllers/presenting.php +++ b/controllers/presenting.php @@ -149,11 +149,6 @@ class PresentingController extends MarketController public function details_action($plugin_id) { Navigation::addItem('/pluginmarket/presenting/details', new AutoNavigation(_('Details'), $this->url_for('presenting/details/'.$plugin_id))); $this->marketplugin = new MarketPlugin($plugin_id); - if (Request::isPost() && Request::submitted("delete_plugin") && $this->marketplugin->isRootable()) { - $this->marketplugin->delete(); - PageLayout::postMessage(MessageBox::success(_("Plugin wurde gel�scht."))); - $this->redirect('presenting/overview'); - } $this->marketplugin['rating'] = $this->marketplugin->calculateRating(); $this->marketplugin->store(); @@ -327,5 +322,4 @@ class PresentingController extends MarketController } - } diff --git a/views/myplugins/delete.php b/views/myplugins/delete.php new file mode 100644 index 0000000000000000000000000000000000000000..bc836ca852d9aee2453c43627a0c785028e021ff --- /dev/null +++ b/views/myplugins/delete.php @@ -0,0 +1,8 @@ +<form method="post" action="<?= $controller->url_for('myplugins/delete/' . $marketplugin->getId()) ?>"> + <?= CSRFProtection::tokenTag() ?> + <p><?= sprintf(_('Soll das Plugin %s wirklich unwiederruflich gel�scht werden?'), htmlReady($marketplugin->name)) ?></p> + + <div data-dialog-button> + <?= \Studip\Button::create(_('Endg�ltig l�schen'), 'delete') ?> + </div> +</form> \ No newline at end of file diff --git a/views/presenting/details.php b/views/presenting/details.php index 2dbd3d6ff87f9ba57b92e55739c8ffcac3df8d7f..2a44662999e3c0eb58425bb6bfd863821bc410d2 100644 --- a/views/presenting/details.php +++ b/views/presenting/details.php @@ -282,16 +282,11 @@ if ($icon) { <div style="text-align: center"> <? if ($marketplugin->isWritable()) : ?> + <?= \Studip\LinkButton::create(_("Plugin l�schen"), $controller->url_for('myplugins/delete/' . $marketplugin->getId()), array('data-dialog' => 1)) ?> <?= \Studip\LinkButton::create(_("bearbeiten"), $controller->url_for('myplugins/edit/' . $marketplugin->getId()), array('data-dialog' => 1)) ?> <?= \Studip\LinkButton::create(_("Release hinzuf�gen"), $controller->url_for('myplugins/add_release/' . $marketplugin->getId()), array('data-dialog' => 1)) ?> <? endif ?> <? if ($marketplugin['user_id'] !== $GLOBALS['user']->id) : ?> <?= \Studip\LinkButton::create(_("Plugin abonnieren"), $controller->url_for('presenting/register_for_pluginnews/' . $marketplugin->getId()), array('title' => _("Neuigkeiten des Plugins per Nachricht bekommen."), 'data-dialog' => "1")) ?> <? endif ?> -<? if ($marketplugin->isRootable()) : ?> - <form action="?" method="post" style="display: inline-block; margin: 0px;"> - <input type="hidden" name="plugin_id" value="<?= htmlReady($marketplugin->getId()) ?>"> - <?= \Studip\Button::create(_("L�schen"), "delete_plugin", array('onclick' => "return window.confirm('"._("Plugin wirklich unwiderrufbar l�schen?")."');")) ?> - </form> -<? endif ?> </div>