Skip to content
Snippets Groups Projects
Commit 7d5e4457 authored by Rasmus Fuhse's avatar Rasmus Fuhse
Browse files

bugfixing adding new releases

parent f2f6722b
No related branches found
No related tags found
No related merge requests found
......@@ -45,6 +45,10 @@ class MypluginsController extends PluginController {
public function edit_release_action($release_id) {
$this->release = new MarketRelease($release_id);
$this->marketplugin = new MarketPlugin(Request::option("plugin_id") ?: null);
if (!$this->marketplugin->isNew() && !$this->marketplugin->isWritable()) {
throw new AccessDeniedException("Kein Zugriff");
}
if (Request::isXhr()) {
$this->response->add_header('X-Title', _("Release bearbeiten"));
$this->set_layout(null);
......@@ -139,6 +143,12 @@ class MypluginsController extends PluginController {
throw new Exception("Method not allowed. Try a POST request.");
}
$this->release = new MarketRelease(Request::option("id"));
$this->release['plugin_id'] = Request::option("plugin_id");
$this->release['user_id'] = $GLOBALS['user']->id;
$this->marketplugin = new MarketPlugin(Request::option("plugin_id") ?: null);
if (!$this->marketplugin->isNew() && !$this->marketplugin->isWritable()) {
throw new AccessDeniedException("Kein Zugriff");
}
$release_data = Request::getArray("release");
$this->release->setData($release_data);
if ($release_data['type'] === "zipfile") {
......
pluginname=PluginMarktplatz
pluginclassname=PluginMarket
origin=studip
version=1.0.3
\ No newline at end of file
version=1.0.4
\ No newline at end of file
<form action="<?= PluginEngine::getLink($plugin, array(), "myplugins/save_release") ?>" method="post" class="studip_form" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?= $release->getId() ?>">
<input type="hidden" name="plugin_id" value="<?= $marketplugin->getId() ?>">
<?= $this->render_partial("myplugins/_edit_release.php", array('release' => $release)) ?>
<div data-dialog-button>
......
......@@ -110,7 +110,7 @@ if ($icon) {
<td><?= htmlReady($release->getChecksum()) ?></td>
<td><?= htmlReady($release['downloads']) ?></td>
<td>
<? if ($marketplugin['user_id'] === $GLOBALS['user']->id) : ?>
<? if ($marketplugin->isWritable()) : ?>
<a href="<?= PluginEngine::getLink($plugin, array(), "myplugins/edit_release/".$release->getId()) ?>" data-dialog>
<?= Assets::img("icons/20/blue/edit", array('class' => "text-bottom")) ?>
</a>
......@@ -124,6 +124,17 @@ if ($icon) {
</tr>
<? endforeach ?>
</tbody>
<? if ($marketplugin->isWritable()) : ?>
<tfoot>
<tr>
<td colspan="6">
<a href="<?= PluginEngine::getLink($plugin, array('plugin_id' => $marketplugin->getId()), "myplugins/add_release/".$marketplugin->getId()) ?>" data-dialog>
<?= Assets::img("icons/20/blue/add") ?>
</a>
</td>
</tr>
</tfoot>
<? endif ?>
</table>
......@@ -249,6 +260,6 @@ if ($icon) {
<? if ($marketplugin->isWritable()) : ?>
<div style="text-align: center">
<?= \Studip\LinkButton::create(_("bearbeiten"), PluginEngine::getURL($plugin, array(), "myplugins/edit/".$marketplugin->getId()), array('data-dialog' => 1)) ?>
<?= \Studip\LinkButton::create(_("Release hinzufgen"), PluginEngine::getURL($plugin, array(), "myplugins/add_release/".$marketplugin->getId()), array('data-dialog' => 1)) ?>
<?= \Studip\LinkButton::create(_("Release hinzufgen"), PluginEngine::getURL($plugin, array('plugin_id' => $marketplugin->getId()), "myplugins/add_release/".$marketplugin->getId()), array('data-dialog' => 1)) ?>
</div>
<? endif ?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment