Merge pull request #10426 from owncloud/enhanced-apps-management
Enhanced apps managementremotes/origin/fix-10825
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 299 B |
|
Before Width: | Height: | Size: 299 B After Width: | Height: | Size: 441 B |
|
Before Width: | Height: | Size: 557 B After Width: | Height: | Size: 464 B |
|
Before Width: | Height: | Size: 464 B |
|
Before Width: | Height: | Size: 441 B After Width: | Height: | Size: 594 B |
|
Before Width: | Height: | Size: 594 B After Width: | Height: | Size: 620 B |
|
Before Width: | Height: | Size: 620 B After Width: | Height: | Size: 602 B |
|
Before Width: | Height: | Size: 602 B After Width: | Height: | Size: 621 B |
|
Before Width: | Height: | Size: 621 B After Width: | Height: | Size: 603 B |
|
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 621 B |
|
Before Width: | Height: | Size: 621 B After Width: | Height: | Size: 584 B |
|
Before Width: | Height: | Size: 584 B After Width: | Height: | Size: 557 B |
@ -0,0 +1,30 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2014 Thomas Müller <deepdiver@owncloud.com> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
OC_JSON::checkAdminUser(); |
||||
|
||||
$l = OC_L10N::get('settings'); |
||||
|
||||
$categories = array( |
||||
array('id' => 0, 'displayName' => (string)$l->t('Enabled') ), |
||||
array('id' => 1, 'displayName' => (string)$l->t('Not enabled') ), |
||||
); |
||||
|
||||
if(OC_Config::getValue('appstoreenabled', true)) { |
||||
$categories[] = array('id' => 2, 'displayName' => (string)$l->t('Recommended') ); |
||||
// apps from external repo via OCS |
||||
$ocs = OC_OCSClient::getCategories(); |
||||
foreach($ocs as $k => $v) { |
||||
$categories[] = array( |
||||
'id' => $k, |
||||
'displayName' => str_replace('ownCloud ', '', $v) |
||||
); |
||||
} |
||||
} |
||||
|
||||
OCP\JSON::success($categories); |
||||
@ -0,0 +1,65 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2014 Thomas Müller <deepdiver@owncloud.com> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
OC_JSON::checkAdminUser(); |
||||
|
||||
$l = OC_L10N::get('settings'); |
||||
|
||||
$category = intval($_GET['category']); |
||||
$apps = array(); |
||||
|
||||
switch($category) { |
||||
// installed apps |
||||
case 0: |
||||
$apps = \OC_App::listAllApps(true); |
||||
$apps = array_filter($apps, function($app) { |
||||
return $app['active']; |
||||
}); |
||||
break; |
||||
// not-installed apps |
||||
case 1: |
||||
$apps = \OC_App::listAllApps(true); |
||||
$apps = array_filter($apps, function($app) { |
||||
return !$app['active']; |
||||
}); |
||||
break; |
||||
default: |
||||
if ($category === 2) { |
||||
$apps = \OC_App::getAppstoreApps('approved'); |
||||
$apps = array_filter($apps, function($app) { |
||||
return isset($app['internalclass']) && $app['internalclass'] === 'recommendedapp'; |
||||
}); |
||||
} else { |
||||
$apps = \OC_App::getAppstoreApps('approved', $category); |
||||
} |
||||
if (!$apps) { |
||||
$apps = array(); |
||||
} |
||||
usort($apps, function ($a, $b) { |
||||
$a = (int)$a['score']; |
||||
$b = (int)$b['score']; |
||||
if ($a === $b) { |
||||
return 0; |
||||
} |
||||
return ($a > $b) ? -1 : 1; |
||||
}); |
||||
break; |
||||
} |
||||
|
||||
// fix groups to be an array |
||||
$apps = array_map(function($app){ |
||||
$groups = array(); |
||||
if (is_string($app['groups'])) { |
||||
$groups = json_decode($app['groups']); |
||||
} |
||||
$app['groups'] = $groups; |
||||
$app['canUnInstall'] = !$app['active'] && $app['removable']; |
||||
return $app; |
||||
}, $apps); |
||||
|
||||
OCP\JSON::success(array("apps" => $apps)); |
||||
@ -1,68 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
OC_JSON::checkAdminUser(); |
||||
|
||||
$l = \OC::$server->getL10N('settings'); |
||||
|
||||
if(OC_Config::getValue('appstoreenabled', true)==false) { |
||||
OCP\JSON::success(array('type' => 'external', 'data' => array())); |
||||
} |
||||
|
||||
$enabledApps=OC_App::getEnabledApps(); |
||||
|
||||
if(is_null($enabledApps)) { |
||||
OCP\JSON::error(array('data' => array('message' => $l->t('Unable to load list from App Store')))); |
||||
} |
||||
|
||||
$apps=array(); |
||||
|
||||
// apps from external repo via OCS |
||||
$categoryNames=OC_OCSClient::getCategories(); |
||||
if(is_array($categoryNames)) { |
||||
$categories=array_keys($categoryNames); |
||||
$page=0; |
||||
$filter='approved'; |
||||
$externalApps=OC_OCSClient::getApplications($categories, $page, $filter); |
||||
foreach($externalApps as $app) { |
||||
// show only external apps that aren't enabled yet |
||||
$local=false; |
||||
foreach($enabledApps as $a) { |
||||
if($a === $app['name']) { |
||||
$local=true; |
||||
} |
||||
} |
||||
|
||||
if(!$local) { |
||||
if($app['preview'] === '') { |
||||
$pre=OC_Helper::imagePath('settings', 'trans.png'); |
||||
} else { |
||||
$pre=$app['preview']; |
||||
} |
||||
if($app['label'] === 'recommended') { |
||||
$label='3rd Party'; |
||||
} else { |
||||
$label='Recommended'; |
||||
} |
||||
$apps[]=array( |
||||
'name'=>$app['name'], |
||||
'id'=>$app['id'], |
||||
'active'=>false, |
||||
'description'=>$app['description'], |
||||
'author'=>$app['personid'], |
||||
'license'=>$app['license'], |
||||
'preview'=>$pre, |
||||
'internal'=>false, |
||||
'internallabel'=>$label, |
||||
'update'=>false, |
||||
); |
||||
} |
||||
} |
||||
} |
||||
|
||||
OCP\JSON::success(array('type' => 'external', 'data' => $apps)); |
||||
@ -1,26 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Copyright (c) 2013 Lukas Reschke <lukas@statuscode.ch> |
||||
* This file is licensed under the Affero General Public License version 3 or |
||||
* later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
// Check if admin user |
||||
OC_Util::checkAdminUser(); |
||||
|
||||
// Set the content type to JS |
||||
header('Content-type: application/javascript'); |
||||
|
||||
// Disallow caching |
||||
header("Cache-Control: no-cache, must-revalidate"); |
||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); |
||||
|
||||
$combinedApps = OC_App::listAllApps(); |
||||
|
||||
foreach($combinedApps as $app) { |
||||
echo("appData_".$app['id']."=".json_encode($app)); |
||||
echo("\n"); |
||||
} |
||||
|
||||
echo ("var appid =".json_encode($_GET['appid']).";"); |
||||
@ -1,65 +1,82 @@ |
||||
<?php /** |
||||
* Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com> |
||||
* This file is licensed under the Affero General Public License version 3 or later. |
||||
* See the COPYING-README file. |
||||
*/?> |
||||
<script type="text/javascript" |
||||
src="<?php print_unescaped(OC_Helper::linkToRoute('apps_custom'));?>?appid=<?php p($_['appid']); ?>"></script>
|
||||
<script type="text/javascript" src="<?php print_unescaped(OC_Helper::linkTo('settings/js', 'apps.js'));?>"></script>
|
||||
<script id="categories-template" type="text/x-handlebars-template"> |
||||
{{#each this}} |
||||
<li id="app-category-{{id}}" data-category-id="{{id}}"><a>{{displayName}}</a></li> |
||||
{{/each}} |
||||
|
||||
<div id="app-navigation"> |
||||
<ul class="applist"> |
||||
<?php if(OC_Config::getValue('appstoreenabled', true) === true): ?> |
||||
<li> |
||||
<a class="app-external" target="_blank" href="http://owncloud.org/dev"><?php p($l->t('Add your App'));?> …</a>
|
||||
</li> |
||||
<?php endif; ?> |
||||
<?php if(OC_Config::getValue('appstoreenabled', true) === true): ?> |
||||
<li> |
||||
<a class="app-external" target="_blank" href="http://apps.owncloud.com/?xsortmode=high"><?php p($l->t('More apps'));?> …</a>
|
||||
</li> |
||||
<li> |
||||
<a class="app-external" target="_blank" href="http://owncloud.org/dev"><?php p($l->t('Add your app'));?> …</a>
|
||||
</li> |
||||
<?php endif; ?> |
||||
</script> |
||||
|
||||
<?php foreach($_['apps'] as $app):?> |
||||
<li <?php if($app['active']) print_unescaped('class="active"')?> data-id="<?php p($app['id']) ?>" data-groups="<?php p($app['groups']) ?>"
|
||||
<?php if ( isset( $app['ocs_id'] ) ) { print_unescaped("data-id-ocs=\"{".OC_Util::sanitizeHTML($app['ocs_id'])."}\""); } ?> |
||||
data-type="<?php p($app['internal'] ? 'internal' : 'external') ?>" data-installed="1">
|
||||
<a class="app<?php if(!$app['internal']) p(' externalapp') ?>"
|
||||
href="?appid=<?php p($app['id']) ?>"><?php p($app['name']) ?></a>
|
||||
<?php if(!$app['internal']) |
||||
print_unescaped('<small class="'.OC_Util::sanitizeHTML($app['internalclass']).' list">'.OC_Util::sanitizeHTML($app['internallabel']).'</small>') ?> |
||||
</li> |
||||
<?php endforeach;?> |
||||
|
||||
<?php if(OC_Config::getValue('appstoreenabled', true) === true): ?> |
||||
<li> |
||||
<a class="app-external" target="_blank" href="http://apps.owncloud.com"><?php p($l->t('More Apps'));?> …</a>
|
||||
</li> |
||||
<?php endif; ?> |
||||
</ul> |
||||
</div> |
||||
<div id="app-content"> |
||||
<div class="appinfo"> |
||||
<h3><strong><span class="name"><?php p($l->t('Select an App'));?></span></strong><span
|
||||
class="version"></span><small class="externalapp" style="visibility:hidden;"></small></h3> |
||||
<span class="score"></span> |
||||
<p class="description"></p> |
||||
<p class="documentation hidden"> |
||||
<script id="app-template" type="text/x-handlebars"> |
||||
<div class="section" id="app-{{id}}"> |
||||
{{#if preview}} |
||||
<div class="app-image{{#if previewAsIcon}} app-image-icon{{/if}} hidden"> |
||||
</div> |
||||
{{/if}} |
||||
<h2 class="app-name"><a href="{{detailpage}}" target="_blank">{{name}}</a></h2> |
||||
<div class="app-version"> {{version}}</div> |
||||
<div class="app-author"><?php p($l->t('by')); ?> {{author}}
|
||||
{{#if license}} |
||||
({{license}}-<?php p($l->t('licensed')); ?>)
|
||||
{{/if}} |
||||
</div> |
||||
{{#if score}} |
||||
<div class="app-score">{{{score}}}</div> |
||||
{{/if}} |
||||
{{#if internalclass}} |
||||
<div class="{{internalclass}} icon-checkmark">{{internallabel}}</div> |
||||
{{/if}} |
||||
<div class="app-detailpage"></div> |
||||
<div class="app-description"><pre>{{description}}</pre></div> |
||||
<!--<div class="app-changed">{{changed}}</div>--> |
||||
{{#if documentation}} |
||||
<p class="documentation"> |
||||
<?php p($l->t("Documentation:"));?> |
||||
<span class="userDocumentation appslink"></span> |
||||
<span class="adminDocumentation appslink"></span> |
||||
{{#if documentation.user}} |
||||
<span class="userDocumentation appslink"> |
||||
<a id='userDocumentation' href='{{documentation.user}}' target="_blank"><?php p($l->t("User Documentation"));?></a>
|
||||
</span> |
||||
{{/if}} |
||||
|
||||
{{#if documentation.admin}} |
||||
<span class="adminDocumentation appslink"> |
||||
<a id='adminDocumentation' href='{{documentation.admin}}' target="_blank"><?php p($l->t("Admin Documentation"));?></a>
|
||||
</span> |
||||
{{/if}} |
||||
</p> |
||||
<img src="" class="preview hidden" /> |
||||
<p class="appslink appstore hidden"><a id="appstorelink" href="#" target="_blank"><?php |
||||
p($l->t('See application page at apps.owncloud.com'));?></a></p> |
||||
<p class="appslink website hidden"><a id="websitelink" href="#" target="_blank"><?php |
||||
p($l->t('See application website'));?></a></p> |
||||
<p class="license hidden"><?php |
||||
print_unescaped($l->t('<span class="licence"></span>-licensed by <span class="author"></span>'));?></p> |
||||
<input class="enable hidden" type="submit" /> |
||||
<input class="update hidden" type="submit" value="<?php p($l->t('Update')); ?>" />
|
||||
<a class="uninstall hidden" href="#"><?php p($l->t('Uninstall')); ?></a>
|
||||
<br /> |
||||
<input class="hidden" type="checkbox" id="groups_enable"/> |
||||
<label class="hidden" for="groups_enable"><?php p($l->t('Enable only for specific groups')); ?></label>
|
||||
{{/if}} |
||||
{{#if update}} |
||||
<input class="update" type="submit" value="<?php p($l->t('Update to %s', array('{{update}}'))); ?>" data-appid="{{id}}" />
|
||||
{{/if}} |
||||
{{#if active}} |
||||
<input class="enable" type="submit" data-appid="{{id}}" data-active="true" value="<?php p($l->t("Disable"));?>"/>
|
||||
<input type="checkbox" class="groups-enable" id="groups_enable-{{id}}"/> |
||||
<label for="groups_enable-{{id}}"><?php p($l->t('Enable only for specific groups')); ?></label>
|
||||
<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" value="<?php p($l->t("Enable"));?>"/>
|
||||
{{/if}} |
||||
{{#if canUnInstall}} |
||||
<input class="uninstall" type="submit" value="<?php p($l->t('Uninstall App')); ?>" data-appid="{{id}}" />
|
||||
{{/if}} |
||||
|
||||
<div class="warning hidden"></div> |
||||
|
||||
</div> |
||||
</script> |
||||
|
||||
<div id="app-navigation" class="icon-loading"> |
||||
<ul id="apps-categories"> |
||||
|
||||
</ul> |
||||
</div> |
||||
<div id="app-content"> |
||||
<div id="apps-list" class="icon-loading"></div> |
||||
</div> |
||||
|
||||