Skip to content
Snippets Groups Projects
Commit 2eb9fd5d authored by Florian Bieringer's avatar Florian Bieringer
Browse files

#59 delete plugin

parents 4f824438 3d2328a1
No related branches found
No related tags found
1 merge request!62#59 Plugin löschen
Showing
with 764 additions and 27 deletions
.gitignore 100644 → 100755
File mode changed from 100644 to 100755
......@@ -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();
......@@ -15,6 +26,7 @@ class PluginMarket extends StudIPPlugin implements SystemPlugin, HomepagePlugin
$top->addSubNavigation("presenting", $overview);
$overview->addSubNavigation("overview", new AutoNavigation(_('bersicht'), PluginEngine::getURL($this, array(), "presenting/overview")));
$overview->addSubNavigation("all", new AutoNavigation(_('Alle Plugins'), PluginEngine::getURL($this, array(), "presenting/all")));
$overview->addSubNavigation("tools", new AutoNavigation(_('Tools'), PluginEngine::getURL($this, array(), "tools/sidebar_graphics_generator")));
if ($GLOBALS['perm']->have_perm("autor")) {
$top->addSubNavigation("myplugins", new Navigation(_("Meine Plugins"), PluginEngine::getURL($this, array(), "myplugins/overview")));
......@@ -43,6 +55,7 @@ class PluginMarket extends StudIPPlugin implements SystemPlugin, HomepagePlugin
public function initialize()
{
PageLayout::addSqueezePackage('lightbox');
$this->addStylesheet('assets/pluginmarket.less');
PageLayout::addHeadElement('link', array(
'rel' => 'alternate',
......
Readme.md 100644 → 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -10,7 +10,7 @@
.flex-justify-content(center);
.flex-align-items(stretch);
> .image {
.image {
padding: 5px;
border: 5px solid #eeeeee;
margin: 5px;
......
File mode changed from 100644 to 100755
This diff is collapsed.
STUDIP.SidebarGraphicsGenerator = {
file: null,
setFile: function (input) {
var files = input.files;
var file = files[0];
jQuery("#downloader").attr("download", "sidebar-" + file.name.substr(0, file.name.lastIndexOf(".")) + ".png");
var reader = new FileReader;
reader.onload = function () {
STUDIP.SidebarGraphicsGenerator.file = new Image();
STUDIP.SidebarGraphicsGenerator.file.src = reader.result;
jQuery("#icon").attr("src", reader.result);
window.setTimeout(STUDIP.SidebarGraphicsGenerator.drawImage, 200)
};
reader.readAsDataURL(file);
jQuery("#save_instructions").show();
},
drawImage: function () {
var canvas = window.document.getElementById("sidebar_image");
var ctx = canvas.getContext("2d");
ctx.clearRect(0,0,520,200);
ctx.globalAlpha = 1;
ctx.fillStyle = jQuery("#color").val();
ctx.fillRect(0,0,520,200);
var gradient = ctx.createLinearGradient(0,0,520,0);
gradient.addColorStop(0, "rgba(255,255,255,0.0)");
gradient.addColorStop(1, "rgba(255,255,255,0.1)");
ctx.fillStyle = gradient;
ctx.fillRect(0,0,520,200);
if (STUDIP.SidebarGraphicsGenerator.file !== null) {
var icon = jQuery("#icon")[0];
var pre_icon = window.document.getElementById("pre_icon");
var pre_icon_ctx = pre_icon.getContext("2d");
pre_icon_ctx.globalAlpha = 1;
pre_icon_ctx.clearRect(0, 0, 320, 320);
pre_icon_ctx.drawImage(icon, 0, 0, 320, 320);
ctx.globalCompositeOperation = "overlay";
ctx.globalAlpha = 0.9;
ctx.drawImage(pre_icon, 250, -100, 320, 320);
ctx.globalAlpha = 0.35;
ctx.drawImage(pre_icon, 20, 50, 300, 300);
ctx.globalCompositeOperation = "source-over";
ctx.globalAlpha = 1;
ctx.drawImage(pre_icon, 60, 30, 70, 70);
}
ctx.globalAlpha = 0.5;
ctx.fillStyle = jQuery("#color").val();
ctx.fillRect(0,140,520,60);
}
};
jQuery(STUDIP.SidebarGraphicsGenerator.drawImage);
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -82,6 +82,9 @@ STUDIP.table = function (element, opt) {
} else if (sortType === 'int') {
sort1 = parseFloat('0' + $(a).find('td:nth-child(' + headerIndex + ')').text().trim());
sort2 = parseFloat('0' + $(b).find('td:nth-child(' + headerIndex + ')').text().trim());
} else if (sortType === 'sorter') {
sort1 = parseFloat('0' + $(a).find('td:nth-child(' + headerIndex + ')').data('sorter'));
sort2 = parseFloat('0' + $(b).find('td:nth-child(' + headerIndex + ')').data('sorter'));
} else {
sort1 = $(a).find('td:nth-child(' + headerIndex + ')').text().trim().toLowerCase();
sort2 = $(b).find('td:nth-child(' + headerIndex + ')').text().trim().toLowerCase();
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
bootstrap.php 100644 → 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -146,22 +146,11 @@ class MarketPlugin extends SimpleORMap {
}
public function calculateRating() {
$cache = StudipCacheFactory::getCache();
$cache_key = 'pluginmarket_rating/'.$this->getId();
$rating = $cache->read($cache_key);
if ($rating === false) {
$latest_release_date = $this->releases[0]->mkdate;
$rating = 0;
$factors = 0;
foreach ($this->reviews as $review) {
$factor = (120 * 86400) / ($latest_release_date - $review['chdate']);
if ($factor < 0) {
$factor = 1;
}
if ($factor > 1) {
$factor = 1;
}
$age = time() - $review['chdate'];
$factor = (pi() - 2 * atan($age / (86400 * 180))) / pi();
$rating += $review['rating'] * $factor * 2;
$factors += $factor;
}
......@@ -171,8 +160,6 @@ class MarketPlugin extends SimpleORMap {
return $rating = null;
}
$cache->write($cache_key, $rating, 60 * 5);
}
return $rating;
}
}
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -119,6 +119,12 @@ class MarketRelease extends SimpleORMap {
}
$this['studip_min_version'] = $manifest['studipMinVersion'];
$this['studip_max_version'] = $manifest['studipMaxVersion'];
if (!$this['studip_max_version']) {
$versions = PluginMarket::getStudipReleases();
$manifest['studipMaxVersion']
= $this['studip_max_version']
= array_pop($versions).".99";
}
$this['version'] = $manifest['version'];
if ($this['repository_overwrites_descriptionfrom']) {
$readme = "";
......@@ -135,6 +141,7 @@ class MarketRelease extends SimpleORMap {
}
}
$this->store();
file_put_contents($dir."/plugin.manifest", $this->createManifest($manifest));
$hash = md5(uniqid());
$plugin_raw = $GLOBALS['TMP_PATH']."/plugin_$hash.zip";
create_zip_from_directory($dir, $plugin_raw);
......@@ -154,4 +161,12 @@ class MarketRelease extends SimpleORMap {
&& ( !$this->studip_max_version || version_compare($version, $this->studip_max_version) <= 0 );
}
protected function createManifest($manifest) {
$arr = array();
foreach ($manifest as $index => $value) {
$arr[] = $index."=".$value;
}
return implode("\n", $arr);
}
}
\ 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