Skip to content
Snippets Groups Projects
Commit 4f824438 authored by Florian Bieringer's avatar Florian Bieringer
Browse files

Add delete option

parent 8622d6a7
No related branches found
No related tags found
2 merge requests!62#59 Plugin löschen,!54#20 let multiple plugin usages be reported
......@@ -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
......@@ -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 gelscht.")));
$this->redirect('presenting/overview');
}
$this->marketplugin['rating'] = $this->marketplugin->calculateRating();
$this->marketplugin->store();
......@@ -327,5 +322,4 @@ class PresentingController extends MarketController
}
}
<form method="post" action="<?= $controller->url_for('myplugins/delete/' . $marketplugin->getId()) ?>">
<?= CSRFProtection::tokenTag() ?>
<p><?= sprintf(_('Soll das Plugin %s wirklich unwiederruflich gelscht werden?'), htmlReady($marketplugin->name)) ?></p>
<div data-dialog-button>
<?= \Studip\Button::create(_('Endgltig lschen'), 'delete') ?>
</div>
</form>
\ No newline at end of file
......@@ -282,16 +282,11 @@ if ($icon) {
<div style="text-align: center">
<? if ($marketplugin->isWritable()) : ?>
<?= \Studip\LinkButton::create(_("Plugin lschen"), $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 hinzufgen"), $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(_("Lschen"), "delete_plugin", array('onclick' => "return window.confirm('"._("Plugin wirklich unwiderrufbar lschen?")."');")) ?>
</form>
<? endif ?>
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment