diff --git a/PluginMarket.class.php b/PluginMarket.class.php index 930a7a8febeb0abd609918c887671d6f9bd82f26..1b09a8745a2b03879d9722b54af14aaef101e101 100644 --- a/PluginMarket.class.php +++ b/PluginMarket.class.php @@ -13,6 +13,10 @@ class PluginMarket extends StudIPPlugin implements SystemPlugin { $top->addSubNavigation("myplugins", new Navigation(_("Meine Plugins"), PluginEngine::getURL($this, array(), "myplugins/overview"))); } Navigation::addItem("/pluginmarket", $top); + + $loginlink = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "presenting/overview")); + $loginlink->setDescription(_("Laden Sie hier Plugins f�r Ihr Stud.IP herunter")); + Navigation::addItem("/login/pluginmarket",$loginlink); } public function getDisplayTitle() { diff --git a/controllers/myplugins.php b/controllers/myplugins.php index d8fb78fa67f53a6af1ca269b34a86e8270f12cdb..72e7facefadb74646f12a97ceb8f0c2b9d622481 100644 --- a/controllers/myplugins.php +++ b/controllers/myplugins.php @@ -8,6 +8,7 @@ class MypluginsController extends PluginController { parent::before_filter($action, $args); Navigation::activateItem("/pluginmarket/myplugins"); + $this->set_content_type('text/html;charset=windows-1252'); } public function overview_action() @@ -15,4 +16,30 @@ class MypluginsController extends PluginController { $this->plugins = MarketPlugin::findBySQL("1=1"); } + public function add_action() { + $this->marketplugin = new MarketPlugin(); + if (Request::isXhr()) { + $this->set_layout(null); + } + $this->render_action("edit"); + } + + public function edit_action($plugin_id) { + $this->marketplugin = new MarketPlugin($plugin_id); + } + + public function save_action() { + if (!Request::isPost()) { + throw new Exception("Method not allowed. Try a POST request."); + } + $this->marketplugin = new MarketPlugin(Request::option("id") ?: null); + $this->marketplugin->setData(Request::getArray("data")); + if ($this->marketplugin->isNew()) { + $this->marketplugin['user_id'] = $GLOBALS['user']->id; + } + $this->marketplugin->store(); + PageLayout::postMessage(MessageBox::success(_("Plugin wurde gespeichert."))); + $this->redirect("pluginmarket/presenting/details/".$this->marketplugin->getId()); + } + } \ No newline at end of file diff --git a/controllers/presenting.php b/controllers/presenting.php index 2f059af5f68d3261effb8f8ceb9d82c444749a5d..acffbd80ae85eaca8d3117f2990aef72648df715 100644 --- a/controllers/presenting.php +++ b/controllers/presenting.php @@ -14,4 +14,8 @@ class PresentingController extends PluginController { $this->plugins = MarketPlugin::findBySQL("1=1"); } + public function details_action($plugin_id) { + $this->marketplugin = new MarketPlugin($plugin_id); + } + } \ No newline at end of file diff --git a/views/myplugins/edit.php b/views/myplugins/edit.php index 368f32c8997784bb6bd5f66c0e49f4bb8ba68f33..3dfaf1a7ed47306837f76db30f5003552ea25ad6 100644 --- a/views/myplugins/edit.php +++ b/views/myplugins/edit.php @@ -1,3 +1,94 @@ -<form action="?" method="post"> +<form action="<?= PluginEngine::getLink($plugin, array(), "myplugins/save") ?>" method="post" class="studip_form"> + <input type="hidden" name="id" value="<?= $marketplugin->getId() ?>"> + <fieldset> + <legend> + <?= _("Informationen") ?> + </legend> + <label> + <?= _("Name des Plugins") ?> + <input type="text" name="data[name]" value="<?= htmlReady($marketplugin['name']) ?>"> + </label> + <label> + <?= _("Kurzbeschreibung") ?> + <input type="text" name="data[short_description]" value="<?= htmlReady($marketplugin['short_description']) ?>" maxlength="160"> + </label> + + <label> + <?= _("Sprache") ?> + <select name="data[language]"> + <option value="de"<?= $marketplugin['language'] === "de" ? " selected" : "" ?>><?= _("Deutsch") ?></option> + <option value="en"<?= $marketplugin['language'] === "en" ? " selected" : "" ?>><?= _("Englisch") ?></option> + <option value="de_en"<?= $marketplugin['language'] === "de_en" ? " selected" : "" ?>><?= _("Deutsch und Englisch") ?></option> + </select> + </label> + + <label> + <?= _("Lange Beschreibung") ?> + <textarea class="add_toolbar" name="data[description]"><?= htmlReady($marketplugin['description']) ?></textarea> + </label> + + <div> + <?= _("Lizenz") ?> + <input type="hidden" name="data[license]" value="GPL 2 or later"> + <p class="info"> + <?= _("Stud.IP-Plugins m�ssen immer mindestens GPL 2 lizensiert sein. Durch das Hochladen erkl�ren Sie, dass auch Ihr Plugin unter der GPL liegt und liegen darf. Wenn Sie nicht das Recht haben, das zu entscheiden, laden Sie jetzt bitte nichts hoch.") ?> + </p> + </div> + </fieldset> + + <fieldset> + <legend> + <?= _("Release hinzuf�gen") ?> + </legend> + + <label> + <?= _("Releasebezeichnung") ?> + <input type="text" name="release[name]" placeholder="<?= _("z.B. Rocky Raccoon 3.0.1") ?>"> + </label> + + <div> + <label> + <input type="radio" name="release[type]" value="zipfile"> + <?= _("Als Datei") ?> + </label> + <label> + <input type="radio" name="release[type]" value="git"> + <?= _("Als Git-Branch") ?> + </label> + </div> + + <fieldset> + <legend> + <?= _("ZIP ausw�hlen") ?> + </legend> + <label> + <a style="cursor: pointer"> + <?= Assets::img("icons/20/blue/upload") ?> + <input type="file" name="release[file]"> + </a> + </label> + </fieldset> + + <fieldset> + <legend> + <?= _("Git-Branch") ?> + </legend> + + <label> + <?= _("Download-URL des Branches oder des Tags") ?> + <input type="release[git_download]"> + </label> + <p class="info"> + <?= _("Github und gitlab bieten zu jedem Branch und Tag den Download als ZIP-Datei an. Klicken Sie dort mit rechter Maustaste auf den Downloadbutton und kopieren Sie die URL, um sie hier einzuf�gen. Nach dem Speichern hier k�nnen Sie auf github bzw. gitlab Webhooks einrichten, damit der Marktplatz sich automatisch die neuste Version des Plugins vom Repository holt.") ?> + </p> + + </fieldset> + </fieldset> + + + + <div data-dialog-button> + <?= \Studip\Button::create(_("speichern")) ?> + </div> </form> \ No newline at end of file diff --git a/views/myplugins/overview.php b/views/myplugins/overview.php index 58f8f0283aaf92407cac4283bb390300d9b4a053..9e416451a636d714da3a8d3698aa5d0b43e3425c 100644 --- a/views/myplugins/overview.php +++ b/views/myplugins/overview.php @@ -6,6 +6,6 @@ $sidebar = Sidebar::Get(); $sidebar->setImage(Assets::image_path("sidebar/plugin-sidebar.png")); $actions = new ActionsWidget(); -$actions->addLink(_("Neues Plugin eintragen"), PluginEngine::getURL($plugin, array(), "myplugins/add")); +$actions->addLink(_("Neues Plugin eintragen"), PluginEngine::getURL($plugin, array(), "myplugins/add"), null, array('data-dialog' => 1)); $sidebar->addWidget($actions); diff --git a/views/presenting/details.php b/views/presenting/details.php new file mode 100644 index 0000000000000000000000000000000000000000..5cc5b899f3a007cbd06d56eac323878ed18eb6a4 --- /dev/null +++ b/views/presenting/details.php @@ -0,0 +1,4 @@ +<h1><?= htmlReady($marketplugin['name']) ?></h1> +<div> + <?= formatReady($marketplugin['description']) ?> +</div> \ No newline at end of file diff --git a/views/presenting/overview.php b/views/presenting/overview.php index d42af8692494fc15b2f0b4f80f6f1850c9d3d33b..8eb1da321f109ccf68780c471cf2d8e02fe5171c 100644 --- a/views/presenting/overview.php +++ b/views/presenting/overview.php @@ -31,10 +31,10 @@ width: calc(100% + 8px); height: 150px; background-position: center center; - background-size: auto 100%; + background-size: auto calc(100% - 6px); background-repeat: no-repeat; background-color: white; - box-shadow: inset 0px 0px 3px rgba(0,0,0,0.3); + box-shadow: inset 0px 0px 4px rgba(0,0,0,0.3); } .plugins_shortview > article > .shortdescription { font-size: 0.9em; @@ -57,12 +57,12 @@ Zentrale Archivierung/L�schung von Veranstaltungen durch Admins. Die Veranstaltungen k�nnen nach verschiedenen Kriterien eingeschr�nkt werden. </p> </article> - <? foreach ($plugins as $plugin) : ?> + <? foreach ($plugins as $marketplugin) : ?> <article> - <h1><a href=""><?= htmlReady($plugin['name']) ?></a></h1> + <h1><a href="<?= PluginEngine::getLink($plugin, array(), "presenting/details/".$marketplugin->getId()) ?>"><?= htmlReady($marketplugin['name']) ?></a></h1> <div class="image" style="background-image: url(http://plugins.studip.de/content/screenshots/a1d85f695cfe506241d398d272ae43f0_thumb);"></div> <p class="shortdescription"> - <?= htmlReady($plugin['short_description']) ?> + <?= htmlReady($marketplugin['short_description']) ?> </p> </article> <? endforeach ?>