From 0f496d55ad43ee1512060667df3054659156bac9 Mon Sep 17 00:00:00 2001 From: Rasmus Fuhse <krassmus@gmail.com> Date: Sat, 28 Mar 2015 21:27:04 +0100 Subject: [PATCH] re #33 : add studipMaxVersion if not set in manifest --- PluginMarket.class.php | 11 +++++++++++ classes/MarketRelease.class.php | 4 ++++ controllers/market_controller.php | 1 + controllers/presenting.php | 3 +-- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/PluginMarket.class.php b/PluginMarket.class.php index 54ce52a..fa1354a 100644 --- a/PluginMarket.class.php +++ b/PluginMarket.class.php @@ -5,6 +5,17 @@ class PluginMarket extends StudIPPlugin implements SystemPlugin, HomepagePlugin { static protected $studip_domain = null; + static public function getStudipReleases() + { + return array( + '1.4', '1.5', '1.6', '1.7', '1.8', + '1.9', '1.10', '1.11', + '2.0', '2.1', '2.2', '2.3', '2.4', + '2.5', + '3.0', '3.1', '3.2' + ); + } + public function __construct() { parent::__construct(); diff --git a/classes/MarketRelease.class.php b/classes/MarketRelease.class.php index 4d9bb39..4750944 100644 --- a/classes/MarketRelease.class.php +++ b/classes/MarketRelease.class.php @@ -119,6 +119,10 @@ class MarketRelease extends SimpleORMap { } $this['studip_min_version'] = $manifest['studipMinVersion']; $this['studip_max_version'] = $manifest['studipMaxVersion']; + if (!$this['studip_max_version']) { + $versions = PluginMarket::getStudipReleases(); + $this['studip_max_version'] = array_pop($versions).".99"; + } $this['version'] = $manifest['version']; if ($this['repository_overwrites_descriptionfrom']) { $readme = ""; diff --git a/controllers/market_controller.php b/controllers/market_controller.php index 758157c..3ca1f13 100644 --- a/controllers/market_controller.php +++ b/controllers/market_controller.php @@ -3,6 +3,7 @@ require_once 'app/controllers/plugin_controller.php'; class MarketController extends PluginController { + public function absolute_url_for($to) { $old_base = URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']); diff --git a/controllers/presenting.php b/controllers/presenting.php index 4cf17d6..b400214 100644 --- a/controllers/presenting.php +++ b/controllers/presenting.php @@ -69,10 +69,9 @@ class PresentingController extends MarketController // Create options for all studip versions $_SESSION['pluginmarket']['version'] = Request::submitted('version') ? Request::get('version') : $_SESSION['pluginmarket']['version']; - $studipVersions = array('1.4.0','1.5.0','1.6.0','1.7','1.8','1.9','1.10','1.11','2.0','2.1','2.2','2.3','2.4','2.5','3.0','3.1'); $options[] = "<option value='".URLHelper::getLink('', array('version' => 0))."'>"._('Alle Versionen')."</option>"; - foreach (array_reverse($studipVersions) as $version) { + foreach (array_reverse(PluginMarket::getStudipReleases()) as $version) { $options[] = "<option value='".URLHelper::getLink('', array('version' => $version))."' ".($_SESSION['pluginmarket']['version'] == $version ? "SELECTED" : "").">$version</option>"; } $versionWidget->addElement(new WidgetElement('<select style="width: 100%" onchange="location = this.options[this.selectedIndex].value;">'.join("", $options).'</select>')); -- GitLab