diff --git a/assets/pluginmarket.less b/assets/pluginmarket.less index 43cc227e80b27c4a836148dc97fc6e30db3d4b88..5c1b643ce43415d15f3ffd3b507e06dde44ba11e 100755 --- a/assets/pluginmarket.less +++ b/assets/pluginmarket.less @@ -79,6 +79,9 @@ #gradient .vertical(fadeout(#fff, 100%), #fff); } } + &.deprecated { + opacity: 0.5; + } } &.new > article { diff --git a/controllers/myplugins.php b/controllers/myplugins.php index 0dab40611046bb34fd4426c72d2845b41c0d0088..f8d17849c5dbe6f2c0dbd2d2f980a7d003b934d2 100755 --- a/controllers/myplugins.php +++ b/controllers/myplugins.php @@ -96,6 +96,12 @@ class MypluginsController extends MarketController if (!isset($data["donationsaccepted"])) { $data['donationsaccepted'] = 0; } + if (!$this->marketplugin->isRootable() && isset($data['deprecated'])) { + unset($data['deprecated']); + } + if ($this->marketplugin->isRootable() && !isset($data['deprecated'])) { + $data['deprecated'] = 0; + } $this->marketplugin->setData($data); if ($this->marketplugin->isNew() && (MarketPlugin::findOneByPluginname($this->marketplugin->pluginname) || !strlen(trim($this->marketplugin->pluginname)))) { PageLayout::postError(_("Ein Plugin mit diesem Namen ist schon im Marktplatz vorhanden!")); diff --git a/controllers/presenting.php b/controllers/presenting.php index 93ce2949d680bf579a7277bbbf6c0bff7666e2e0..798f3894b285be5b16eee98d7597d514030b8bfb 100755 --- a/controllers/presenting.php +++ b/controllers/presenting.php @@ -87,9 +87,9 @@ class PresentingController extends MarketController } } - $this->plugins = MarketPlugin::findBySQL("publiclyvisible = 1 AND approved = 1 ORDER BY RAND() LIMIT 3"); + $this->plugins = MarketPlugin::findBySQL("publiclyvisible = 1 AND approved = 1 AND deprecated = 0 ORDER BY RAND() LIMIT 3"); - $this->latest_plugins = MarketPlugin::findBySQL("publiclyvisible = 1 AND approved = 1 ORDER BY mkdate DESC LIMIT 5"); + $this->latest_plugins = MarketPlugin::findBySQL("publiclyvisible = 1 AND approved = 1 AND deprecated = 0 ORDER BY mkdate DESC LIMIT 5"); $best = DBManager::get()->prepare(" SELECT pluginmarket_plugins.* @@ -97,6 +97,7 @@ class PresentingController extends MarketController LEFT JOIN pluginmarket_reviews ON (pluginmarket_plugins.plugin_id = pluginmarket_reviews.plugin_id) WHERE publiclyvisible = 1 AND approved = 1 + AND deprecated = 0 GROUP BY pluginmarket_plugins.plugin_id ORDER BY pluginmarket_plugins.rating DESC, MAX(pluginmarket_reviews.chdate) DESC LIMIT 6 @@ -123,7 +124,7 @@ class PresentingController extends MarketController ) AND publiclyvisible = 1 AND approved = 1 - ORDER BY (IF(name LIKE :likesearch, 6, 0) + MATCH (short_description, description) AGAINST (:search)),name ", array( + ORDER BY deprecated ASC, (IF(name LIKE :likesearch, 6, 0) + MATCH (short_description, description) AGAINST (:search)), name ", array( 'likesearch' => "%".Request::get("search")."%", 'search' => Request::get("search") ) @@ -136,7 +137,7 @@ class PresentingController extends MarketController WHERE pluginmarket_tags.tag = :tag AND pluginmarket_plugins.approved = 1 AND pluginmarket_plugins.publiclyvisible = 1 - ORDER BY name + ORDER BY deprecated ASC, name ASC "); $statement->execute(array('tag' => Request::get("tag"))); $plugin_data = $statement->fetchAll(PDO::FETCH_ASSOC); @@ -148,7 +149,7 @@ class PresentingController extends MarketController $this->plugins[] = $plugin; } } else { - $this->plugins = MarketPlugin::findBySQL("publiclyvisible = 1 AND approved = 1 ORDER BY name ASC"); + $this->plugins = MarketPlugin::findBySQL("publiclyvisible = 1 AND approved = 1 AND deprecated = 0 ORDER BY name ASC"); } // Filter version @@ -179,6 +180,10 @@ class PresentingController extends MarketController $this->marketplugin['rating'] = $this->marketplugin->calculateRating(); $this->marketplugin->store(); + if ($this->marketplugin['deprecated']) { + PageLayout::postInfo(_("Dieses Plugin gilt als veraltet.")); + } + // Add actions widget $sidebar = Sidebar::Get(); $actions = new ActionsWidget(); diff --git a/migrations/07_add_pluginname.php b/migrations/07_add_pluginname.php index 268b52586d402509608391867c4d0b48e7632ccb..4d1255ba6bde0a624816d555ccac497752ea0126 100644 --- a/migrations/07_add_pluginname.php +++ b/migrations/07_add_pluginname.php @@ -1,39 +1,39 @@ <?php class AddPluginname extends Migration { -public function up() { + public function up() { - DBManager::get()->exec(" - ALTER TABLE `pluginmarket_plugins` CHANGE `pluginclassname` `pluginname` VARCHAR(64) NOT NULL - "); - SimpleORMap::expireTableScheme(); - foreach (MarketPlugin::findBySQL("1") as $plugin) { - if ($plugin->releases->count()) { - $pluginnames = array_count_values(array_filter($plugin->releases->getPluginName())); - arsort($pluginnames); - $pluginname = key($pluginnames); - if ($pluginname) { - $plugin->pluginname = $pluginname; + DBManager::get()->exec(" + ALTER TABLE `pluginmarket_plugins` CHANGE `pluginclassname` `pluginname` VARCHAR(64) NOT NULL + "); + SimpleORMap::expireTableScheme(); + foreach (MarketPlugin::findBySQL("1") as $plugin) { + if ($plugin->releases->count()) { + $pluginnames = array_count_values(array_filter($plugin->releases->getPluginName())); + arsort($pluginnames); + $pluginname = key($pluginnames); + if ($pluginname) { + $plugin->pluginname = $pluginname; - $plugin->releases->each(function ($one) use ($pluginname) { - if ($one->getPluginName() != $pluginname) { - $one->delete(); - } - }); + $plugin->releases->each(function ($one) use ($pluginname) { + if ($one->getPluginName() != $pluginname) { + $one->delete(); + } + }); + } else { + $plugin->name .= " (no pluginname)"; + $plugin->releases->delete(); + $plugin->approved = 0; + } } else { - $plugin->name .= " (no pluginname)"; - $plugin->releases->delete(); + $plugin->name .= " (no release)"; $plugin->approved = 0; } - } else { - $plugin->name .= " (no release)"; - $plugin->approved = 0; + $plugin->store(); } - $plugin->store(); } -} -public function down() { -} + public function down() { + } } \ No newline at end of file diff --git a/migrations/08_deprecated_plugins.php b/migrations/08_deprecated_plugins.php new file mode 100644 index 0000000000000000000000000000000000000000..fdbda545e481d87938061a4922d1526137e41906 --- /dev/null +++ b/migrations/08_deprecated_plugins.php @@ -0,0 +1,15 @@ +<?php +class DeprecatedPlugins extends Migration { + + public function up() { + + DBManager::get()->exec(" + ALTER TABLE `pluginmarket_plugins` ADD COLUMN `deprecated` TINYINT(1) NOT NULL DEFAULT '0' AFTER `rating` + "); + SimpleORMap::expireTableScheme(); + } + + public function down() { + } + +} \ No newline at end of file diff --git a/views/myplugins/edit.php b/views/myplugins/edit.php index 67af53800f8a451c4598a60364aef1193e1b4c99..412961fbc9c19fac202c617fc9bbfe088b2d99e5 100755 --- a/views/myplugins/edit.php +++ b/views/myplugins/edit.php @@ -59,6 +59,13 @@ <input type="checkbox" name="data[donationsaccepted]" value="1"<?= $marketplugin->isNew() || $marketplugin['donationsaccepted'] ? " checked" : "" ?>> </label> + <? if ($marketplugin->isRootable()) : ?> + <label> + <?= _("Plugin veraltet") ?> + <input type="checkbox" name="data[deprecated]" value="1"<?= $marketplugin['deprecated'] ? " checked" : "" ?>> + </label> + <? endif ?> + </fieldset> diff --git a/views/presenting/_plugin_short.php b/views/presenting/_plugin_short.php index bf452b4162fa15912e7f52de1a4db8bb54692a6d..c9b36f3bb0cab42c8011e06908c66614450d00a8 100755 --- a/views/presenting/_plugin_short.php +++ b/views/presenting/_plugin_short.php @@ -1,4 +1,4 @@ -<article class="contentbox"> +<article class="contentbox<?= $marketplugin['deprecated'] ? " deprecated" : "" ?>"> <a href="<?= $controller->url_for('presenting/details/' . $marketplugin->getId()) ?>"> <header> <h1><?= htmlReady($marketplugin['name']) ?></h1>