Show tooltip if the app is downloaded from a remote server

fixes #14405
This commit is contained in:
Christoph Wurst 2016-04-11 16:48:07 +02:00
parent 8e16e7bf34
commit 7365bd798a
3 changed files with 28 additions and 1 deletions

View File

@ -259,6 +259,12 @@ class AppSettingsController extends Controller {
$apps = array_filter($apps, function ($app) use ($installedApps) {
return !in_array($app['id'], $installedApps);
});
// show tooltip if app is downloaded from remote server
$inactiveApps = $this->getInactiveApps();
foreach ($apps as &$app) {
$app['needsDownload'] = !in_array($app['id'], $inactiveApps);
}
}
// sort by score
@ -319,4 +325,23 @@ class AppSettingsController extends Controller {
});
return $apps;
}
/**
* @return array
*/
private function getInactiveApps() {
$inactiveApps = \OC_App::listAllApps(true, false, $this->ocsClient);
$inactiveApps = array_filter($inactiveApps,
function ($app) {
return !$app['active'];
});
$inactiveApps = array_map(function($app) {
if (isset($app['ocsid'])) {
return $app['ocsid'];
}
return $app['id'];
}, $inactiveApps);
return $inactiveApps;
}
}

View File

@ -119,6 +119,8 @@ OC.Settings.Apps = OC.Settings.Apps || {
$('#apps-list-empty').removeClass('hidden').find('h2').text(t('settings', 'No apps found for your version'));
}
$('.enable.needs-download').tipsy({fallback: t('settings', 'The app will be downloaded from the app store')});
$('.app-level .official').tipsy({fallback: t('settings', 'Official apps are developed by and within the ownCloud community. They offer functionality central to ownCloud and are ready for production use.')});
$('.app-level .approved').tipsy({fallback: t('settings', 'Approved apps are developed by trusted developers and have passed a cursory security check. They are actively maintained in an open code repository and their maintainers deem them to be stable for casual to normal use.')});
$('.app-level .experimental').tipsy({fallback: t('settings', 'This app is not checked for security issues and is new or known to be unstable. Install at your own risk.')});

View File

@ -134,7 +134,7 @@ script(
<br />
<input type="hidden" id="group_select" title="<?php p($l->t('All')); ?>" style="width: 200px">
{{else}}
<input class="enable" type="submit" data-appid="{{id}}" data-active="false" {{#unless canInstall}}disabled="disabled"{{/unless}} value="<?php p($l->t("Enable"));?>"/>
<input class="enable{{#if needsDownload}} needs-download{{/if}}" type="submit" data-appid="{{id}}" data-active="false" {{#unless canInstall}}disabled="disabled"{{/unless}} value="<?php p($l->t("Enable"));?>"/>
{{/if}}
{{#if canUnInstall}}
<input class="uninstall" type="submit" value="<?php p($l->t('Uninstall App')); ?>" data-appid="{{id}}" />