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

add github readme-import for description

parent fa84a69d
Branches
No related tags found
No related merge requests found
<?php <?php
require_once 'lib/datei.inc.php'; require_once 'lib/datei.inc.php';
require_once __DIR__."/../vendor/Parsedown.php";
class MarketRelease extends SimpleORMap { class MarketRelease extends SimpleORMap {
...@@ -89,6 +90,20 @@ class MarketRelease extends SimpleORMap { ...@@ -89,6 +90,20 @@ class MarketRelease extends SimpleORMap {
if (!$this['version']) { if (!$this['version']) {
$this['version'] = $manifest['version']; $this['version'] = $manifest['version'];
} }
if ($this['repository_overwrites_descriptionfrom']) {
$readme = "";
$scanner = scandir($dir);
foreach ($scanner as $file) {
if (strtolower($file) === "readme.md" || strtolower($file) === "readme.markdown") {
$readme = file_get_contents($dir."/".$file);
}
}
if ($readme) {
$html = Parsedown::instance()->text($readme);
$this->plugin['description'] = "<div>".$html."</div>";
$this->plugin->store();
}
}
$hash = md5(uniqid()); $hash = md5(uniqid());
$plugin_raw = $GLOBALS['TMP_PATH']."/plugin_$hash.zip"; $plugin_raw = $GLOBALS['TMP_PATH']."/plugin_$hash.zip";
create_zip_from_directory($dir, $plugin_raw); create_zip_from_directory($dir, $plugin_raw);
......
...@@ -73,6 +73,9 @@ class MypluginsController extends PluginController { ...@@ -73,6 +73,9 @@ class MypluginsController extends PluginController {
if (!isset($data["publiclyvisible"])) { if (!isset($data["publiclyvisible"])) {
$data['publiclyvisible'] = 0; $data['publiclyvisible'] = 0;
} }
if (!isset($data["donationsaccepted"])) {
$data['donationsaccepted'] = 0;
}
$this->marketplugin->setData($data); $this->marketplugin->setData($data);
if ($this->marketplugin->isNew()) { if ($this->marketplugin->isNew()) {
$this->marketplugin['user_id'] = $GLOBALS['user']->id; $this->marketplugin['user_id'] = $GLOBALS['user']->id;
...@@ -116,6 +119,9 @@ class MypluginsController extends PluginController { ...@@ -116,6 +119,9 @@ class MypluginsController extends PluginController {
$release_data = Request::getArray("release"); $release_data = Request::getArray("release");
if ($release_data['type'] !== "zipfile" || $_FILES['release_file']['tmp_path']) { if ($release_data['type'] !== "zipfile" || $_FILES['release_file']['tmp_path']) {
$release = new MarketRelease(); $release = new MarketRelease();
if (!isset($release_data['repository_overwrites_descriptionfrom'])) {
$release_data['repository_overwrites_descriptionfrom'] = 0;
}
$release->setData($release_data); $release->setData($release_data);
$release['plugin_id'] = $this->marketplugin->getId(); $release['plugin_id'] = $this->marketplugin->getId();
$release['user_id'] = $GLOBALS['user']->id; $release['user_id'] = $GLOBALS['user']->id;
......
...@@ -8,7 +8,8 @@ CREATE TABLE IF NOT EXISTS `pluginmarket_plugins` ( ...@@ -8,7 +8,8 @@ CREATE TABLE IF NOT EXISTS `pluginmarket_plugins` (
`short_description` text NOT NULL, `short_description` text NOT NULL,
`release_type` varchar(255) default NULL, `release_type` varchar(255) default NULL,
`approved` tinyint(2) NOT NULL default '0', `approved` tinyint(2) NOT NULL default '0',
`publiclyvisible` TINYINT NOT NULL DEFAULT '1' `publiclyvisible` TINYINT NOT NULL DEFAULT '1',
`donationsaccepted` TINYINT NOT NULL DEFAULT '1',
`url` varchar(2000) default NULL, `url` varchar(2000) default NULL,
`classification` enum('firstclass','secondclass','none') NOT NULL default 'none', `classification` enum('firstclass','secondclass','none') NOT NULL default 'none',
`language` enum('de','en','de_en') NOT NULL default 'de', `language` enum('de','en','de_en') NOT NULL default 'de',
......
...@@ -27,16 +27,16 @@ if ($_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] != 443 || ...@@ -27,16 +27,16 @@ if ($_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] != 443 ||
<div> <div>
<label> <label>
<input type="radio" name="release[type]" value="zipfile"<?= !$release['repository_download_url'] ? " checked" : "" ?>> <input type="radio" name="release[type]" value="zipfile"<?= !$release['repository_download_url'] ? " checked" : "" ?> onChange="if (this.checked) { jQuery('fieldset.release_zip_upload').show(); jQuery('fieldset.release_internet_repository').hide(); } else { jQuery('fieldset.release_zip_upload').hide(); jQuery('fieldset.release_internet_repository').show(); }">
<?= _("Als Datei") ?> <?= _("Als Datei") ?>
</label> </label>
<label> <label>
<input type="radio" name="release[type]" value="git"<?= $release['repository_download_url'] ? " checked" : "" ?>> <input type="radio" name="release[type]" value="git"<?= $release['repository_download_url'] ? " checked" : "" ?> onChange="if (!this.checked) { jQuery('fieldset.release_zip_upload').show(); jQuery('fieldset.release_internet_repository').hide(); } else { jQuery('fieldset.release_zip_upload').hide(); jQuery('fieldset.release_internet_repository').show(); }">
<?= _("Als Git-Branch") ?> <?= _("Als Git-Branch") ?>
</label> </label>
</div> </div>
<fieldset> <fieldset class="release_zip_upload"<?= $release['repository_download_url'] ? ' style="display: none;"' : "" ?>>
<legend> <legend>
<?= _("ZIP auswhlen") ?> <?= _("ZIP auswhlen") ?>
</legend> </legend>
...@@ -48,7 +48,7 @@ if ($_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] != 443 || ...@@ -48,7 +48,7 @@ if ($_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] != 443 ||
</label> </label>
</fieldset> </fieldset>
<fieldset> <fieldset class="release_internet_repository"<?= $release->isNew() || !$release['repository_download_url'] ? ' style="display: none;"' : "" ?>>
<legend> <legend>
<?= _("Git-Branch") ?> <?= _("Git-Branch") ?>
</legend> </legend>
...@@ -60,10 +60,16 @@ if ($_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] != 443 || ...@@ -60,10 +60,16 @@ if ($_SERVER['HTTPS'] == 'on' && $_SERVER['SERVER_PORT'] != 443 ||
<p class="info"> <p class="info">
<?= _("Github.com 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 einzufgen. Nach dem Speichern hier knnen Sie auf github bzw. gitlab Webhooks einrichten, damit der Marktplatz sich automatisch die neuste Version des Plugins vom Repository holt. Damit ist das Plugin auf dem Pluginmarktplatz immer brandaktuell.") ?> <?= _("Github.com 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 einzufgen. Nach dem Speichern hier knnen Sie auf github bzw. gitlab Webhooks einrichten, damit der Marktplatz sich automatisch die neuste Version des Plugins vom Repository holt. Damit ist das Plugin auf dem Pluginmarktplatz immer brandaktuell.") ?>
</p> </p>
<label>
<input type="checkbox" name="release[repository_overwrites_descriptionfrom]" value="1"<?= $release['repository_overwrites_descriptionfrom'] ? " checked" : "" ?>>
<?= _("Readme-Datei dieses Repositorys als Beschreibung des Plugins verwenden") ?>
</label>
<? if (!$release->isNew()) : ?> <? if (!$release->isNew()) : ?>
<p class="info"> <p class="info">
<?= _("Webhook-URL zum Einfgen in github oder gitlab:") ?> <?= _("Webhook-URL zum Einfgen in github oder gitlab:") ?>
<input type="text" style="border: thin solid #cccccc; background-color: #eeeeee; width:100%;" value="<?= $DOMAIN_STUDIP.URLHelper::getLink("plugins.php/pluginmarket/upate/".$release->getId(), array('s' => $release->getSecurityHash()), true) ?>"> <input type="text" readonly style="border: thin solid #cccccc; background-color: #eeeeee; width:100%;" value="<?= $DOMAIN_STUDIP.URLHelper::getLink("plugins.php/pluginmarket/upate/".$release->getId(), array('s' => $release->getSecurityHash()), true) ?>">
</p> </p>
<? if ($domain_warning) : ?> <? if ($domain_warning) : ?>
<p class="info"><?= htmlReady($domain_warning) ?></p> <p class="info"><?= htmlReady($domain_warning) ?></p>
......
...@@ -33,6 +33,16 @@ ...@@ -33,6 +33,16 @@
<input type="checkbox" name="data[publiclyvisible]" value="1"<?= $marketplugin->isNew() || $marketplugin['publiclyvisible'] ? " checked" : "" ?>> <input type="checkbox" name="data[publiclyvisible]" value="1"<?= $marketplugin->isNew() || $marketplugin['publiclyvisible'] ? " checked" : "" ?>>
</label> </label>
<label>
<?= _("In Benutzung bei") ?>
<textarea name="data[in_use]"><?= htmlReady($marketplugin['in_use']) ?></textarea>
</label>
<label>
<?= _("Projekthomepage") ?>
<input type="text" name="data[url]" value="<?= htmlReady($marketplugin['url']) ?>">
</label>
<div> <div>
<?= _("Lizenz") ?> <?= _("Lizenz") ?>
<input type="hidden" name="data[license]" value="GPL 2 or later"> <input type="hidden" name="data[license]" value="GPL 2 or later">
...@@ -40,6 +50,13 @@ ...@@ -40,6 +50,13 @@
<?= _("Stud.IP-Plugins mssen immer mindestens GPL 2 lizensiert sein. Durch das Hochladen erklren 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.") ?> <?= _("Stud.IP-Plugins mssen immer mindestens GPL 2 lizensiert sein. Durch das Hochladen erklren 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> </p>
</div> </div>
<label>
<?= _("Mglichkeit zum Spenden einblenden") ?>
<input type="checkbox" name="data[donationsaccepted]" value="1"<?= $marketplugin->isNew() || $marketplugin['donationsaccepted'] ? " checked" : "" ?>>
</label>
</fieldset> </fieldset>
<?= $this->render_partial("myplugins/_edit_images.php", compact("marketplugin")) ?> <?= $this->render_partial("myplugins/_edit_images.php", compact("marketplugin")) ?>
......
...@@ -34,6 +34,16 @@ if ($icon) { ...@@ -34,6 +34,16 @@ if ($icon) {
</ol> </ol>
<? endif ?> <? endif ?>
<? if (trim($marketplugin['in_use'])) : ?>
<h2><?= _("In Benutzung bei") ?></h2>
<div><?= formatReady($marketplugin['in_use']) ?></div>
<? endif ?>
<? if ($marketplugin['url']) : ?>
<h2><?= _("Projekthomepage") ?></h2>
<div><?= formatLinks($marketplugin['url']) ?></div>
<? endif ?>
<h2><?= _("Zum Autor") ?></h2> <h2><?= _("Zum Autor") ?></h2>
<ul class="clean"> <ul class="clean">
<li> <li>
...@@ -88,60 +98,60 @@ if ($icon) { ...@@ -88,60 +98,60 @@ if ($icon) {
<? <? if ($marketplugin['donationsaccepted']) : ?>
//Donations, wenn die Datenfelder "Flattr", "Bitcoin-Wallet" gesetzt sind <?
$author = User::find($marketplugin['user_id']); //Donations, wenn die Datenfelder "Flattr", "Bitcoin-Wallet" gesetzt sind
$flattr_username = $author['datafields']->findBy("name", "Flattr")->val("content"); $author = User::find($marketplugin['user_id']);
$bitcoin_datafield = $author['datafields']->findBy("name", "Bitcoin-Wallet")->val("content"); $flattr_username = $author['datafields']->findBy("name", "Flattr")->val("content");
$paypal_datafield = $author['datafields']->findBy("name", "Paypal-Account (Email)")->val("content"); $bitcoin_datafield = $author['datafields']->findBy("name", "Bitcoin-Wallet")->val("content");
?> $paypal_datafield = $author['datafields']->findBy("name", "Paypal-Account (Email)")->val("content");
?>
<? if ($flattr_username || $bitcoin_wallet || $paypal_datafield) : ?>
<h2><?= _("Spenden") ?></h2>
<p class="info">
<?= _("Der Download ist kostenlos, aber man kann dem Autor mit einer Spende danken und zuknftige Entwicklungen anregen.") ?>
</p>
<? endif ?>
<div style="text-align: center;">
<? if ($flattr_username) : ?>
<script id='fbowlml'>(function(i){var f,s=document.getElementById(i);f=document.createElement('iframe');f.src='//api.flattr.com/button/view/?uid=<?= urlencode(studip_utf8encode($flattr_username)) ?>&url='+encodeURIComponent(document.URL)+'&title=<?= urlencode(studip_utf8encode($marketplugin['name']." "._("fr Stud.IP"))) ?>';f.title='Flattr';f.height=62;f.width=55;f.style.borderWidth=0;s.parentNode.insertBefore(f,s);})('fbowlml');</script>
<? endif ?>
<? if ($bitcoin_wallet) : ?>
<script src="http://coinwidget.com/widget/coin.js"></script>
<script>
CoinWidgetCom.go({
wallet_address: "<?= htmlReady($bitcoin_wallet) ?>"
, currency: "bitcoin"
, counter: "count"
, alignment: "bl"
, qrcode: true
, auto_show: false
, lbl_button: "Donate"
, lbl_address: "My Bitcoin Address:"
, lbl_count: "donations"
, lbl_amount: "BTC"
});
</script>
<? endif ?>
<? if ($paypal_datafield) : ?>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" style="display: inline-block;">
<div><strong><img src="http://pics.ebaystatic.com/aw/pics/logos/logoPayPal_51x14.gif"></strong></div>
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="<?= htmlReady($paypal_datafield) ?>">
<input type="hidden" name="lc" value="DE">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="Jetzt einfach, schnell und sicher online bezahlen mit PayPal.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<? if ($flattr_username || $bitcoin_wallet || $paypal_datafield) : ?>
<h2><?= _("Spenden") ?></h2>
<p class="info">
<?= _("Der Download ist kostenlos, aber man kann dem Autor mit einer Spende danken und zuknftige Entwicklungen anregen.") ?>
</p>
<? endif ?> <? endif ?>
</div>
<div style="text-align: center;">
<? if ($flattr_username) : ?>
<script id='fbowlml'>(function(i){var f,s=document.getElementById(i);f=document.createElement('iframe');f.src='//api.flattr.com/button/view/?uid=<?= urlencode(studip_utf8encode($flattr_username)) ?>&url='+encodeURIComponent(document.URL)+'&title=<?= urlencode(studip_utf8encode($marketplugin['name']." "._("fr Stud.IP"))) ?>';f.title='Flattr';f.height=62;f.width=55;f.style.borderWidth=0;s.parentNode.insertBefore(f,s);})('fbowlml');</script>
<? endif ?>
<? if ($bitcoin_wallet) : ?>
<script src="http://coinwidget.com/widget/coin.js"></script>
<script>
CoinWidgetCom.go({
wallet_address: "<?= htmlReady($bitcoin_wallet) ?>"
, currency: "bitcoin"
, counter: "count"
, alignment: "bl"
, qrcode: true
, auto_show: false
, lbl_button: "Donate"
, lbl_address: "My Bitcoin Address:"
, lbl_count: "donations"
, lbl_amount: "BTC"
});
</script>
<? endif ?>
<? if ($paypal_datafield) : ?>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" style="display: inline-block;">
<div><strong><img src="http://pics.ebaystatic.com/aw/pics/logos/logoPayPal_51x14.gif"></strong></div>
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="<?= htmlReady($paypal_datafield) ?>">
<input type="hidden" name="lc" value="DE">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="Jetzt einfach, schnell und sicher online bezahlen mit PayPal.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
<? endif ?>
</div>
<? endif ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment