diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-08-14 15:48:38 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-10-15 15:21:40 +0200 |
commit | b091394a90a22767ec08259eb19a2b0d0294c25d (patch) | |
tree | 8621831f140a8126a933203e14edf213fd58e628 /lib/private | |
parent | 6824a5ce7f5752c2a3ebbe9e2f3a85eb3aafa05b (diff) | |
download | nextcloud-server-b091394a90a22767ec08259eb19a2b0d0294c25d.tar.gz nextcloud-server-b091394a90a22767ec08259eb19a2b0d0294c25d.zip |
introduce new app page layout
filter installed and not-installed apps properly
kill unneeded file
load category 'Installed' on page load
adding documentation links
new apps mgmt: first style adjustment
apps mgmt: only show license and preview if they exist
adding buttons
new apps mgmt: fix for mobile
use app icon if available
new apps mgmt: position enable/disable toggle to the right
new apps mgmt: proper display of icons or previews
new apps mgmt: fix loading spinner
reenable group selection for apps
new apps mgmt: position enable button normally again
new apps mgmt: clarify wording from 'Installed' to 'Enabled'
reintroduce enable/disable
Move rating image path generation to client-side
Move expression outside of l10n
fix group handling
add buttons for 'More apps' and 'Add your app' again
disable changed date of app for now
adding recommended label
style 'Recommended' app tag
fixing php warning
sort by rating
adding meta-category 'Recommended'
Only show existing documentation links
lacy loading of screenshots
making group based app activation work again
adding support to get the app icon not only by the app name but also simply by the fixed name 'app.svg'
adding app.svg for all core apps
query string '?installed' is not longer needed
update and uninstall is back + error feedback
remove unneeded parameter
fix alignment of 'recommended' label
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/app.php | 118 | ||||
-rw-r--r-- | lib/private/installer.php | 3 | ||||
-rw-r--r-- | lib/private/ocsclient.php | 2 |
3 files changed, 58 insertions, 65 deletions
diff --git a/lib/private/app.php b/lib/private/app.php index a356139044c..95a8a7302d9 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -815,7 +815,7 @@ class OC_App { * Lists all apps, this is used in apps.php * @return array */ - public static function listAllApps() { + public static function listAllApps($onlyLocal = false) { $installedApps = OC_App::getAllApps(); //TODO which apps do we want to blacklist and how do we integrate @@ -823,6 +823,7 @@ class OC_App { $blacklist = array('files'); //we don't want to show configuration for these $appList = array(); + $l = \OC::$server->getL10N('core'); foreach ($installedApps as $app) { if (array_search($app, $blacklist) === false) { @@ -849,24 +850,36 @@ class OC_App { if(isset($info['shipped']) and ($info['shipped'] == 'true')) { $info['internal'] = true; - $info['internallabel'] = 'Internal App'; - $info['internalclass'] = ''; + $info['internallabel'] = $l->t('Recommended'); + $info['internalclass'] = 'recommendedapp'; $info['removable'] = false; } else { $info['internal'] = false; - $info['internallabel'] = '3rd Party'; - $info['internalclass'] = 'externalapp'; $info['removable'] = true; } $info['update'] = OC_Installer::isUpdateAvailable($app); - $info['preview'] = OC_Helper::imagePath('settings', 'trans.png'); + $appIcon = self::getAppPath($app) . '/img/' . $app.'.svg'; + if (file_exists($appIcon)) { + $info['preview'] = OC_Helper::imagePath($app, $app.'.svg'); + $info['previewAsIcon'] = true; + } else { + $appIcon = self::getAppPath($app) . '/img/app.svg'; + if (file_exists($appIcon)) { + $info['preview'] = OC_Helper::imagePath($app, 'app.svg'); + $info['previewAsIcon'] = true; + } + } $info['version'] = OC_App::getAppVersion($app); $appList[] = $info; } } - $remoteApps = OC_App::getAppstoreApps(); + if ($onlyLocal) { + $remoteApps = array(); + } else { + $remoteApps = OC_App::getAppstoreApps(); + } if ($remoteApps) { // Remove duplicates foreach ($appList as $app) { @@ -898,9 +911,11 @@ class OC_App { } // priority 3: recommended - if ($a['internalclass'] != $b['internalclass']) { - $aTemp = ($a['internalclass'] == 'recommendedapp' ? 1 : 0); - $bTemp = ($b['internalclass'] == 'recommendedapp' ? 1 : 0); + $internalClassA = isset($a['internalclass']) ? $a['internalclass'] : ''; + $internalClassB = isset($b['internalclass']) ? $b['internalclass'] : ''; + if ($internalClassA != $internalClassB) { + $aTemp = ($internalClassA == 'recommendedapp' ? 1 : 0); + $bTemp = ($internalClassB == 'recommendedapp' ? 1 : 0); return ($bTemp - $aTemp); } @@ -917,63 +932,40 @@ class OC_App { * @return array, multi-dimensional array of apps. * Keys: id, name, type, typename, personid, license, detailpage, preview, changed, description */ - public static function getAppstoreApps($filter = 'approved') { - $categoryNames = OC_OCSClient::getCategories(); - if (is_array($categoryNames)) { - // Check that categories of apps were retrieved correctly - if (!$categories = array_keys($categoryNames)) { + public static function getAppstoreApps($filter = 'approved', $category = null) { + $categories = array($category); + if (is_null($category)) { + $categoryNames = OC_OCSClient::getCategories(); + if (is_array($categoryNames)) { + // Check that categories of apps were retrieved correctly + if (!$categories = array_keys($categoryNames)) { + return false; + } + } else { return false; } + } - $page = 0; - $remoteApps = OC_OCSClient::getApplications($categories, $page, $filter); - $app1 = array(); - $i = 0; - foreach ($remoteApps as $app) { - $app1[$i] = $app; - $app1[$i]['author'] = $app['personid']; - $app1[$i]['ocs_id'] = $app['id']; - $app1[$i]['internal'] = $app1[$i]['active'] = 0; - $app1[$i]['update'] = false; - $app1[$i]['groups'] = false; - $app1[$i]['removable'] = false; - if ($app['label'] == 'recommended') { - $app1[$i]['internallabel'] = 'Recommended'; - $app1[$i]['internalclass'] = 'recommendedapp'; - } else { - $app1[$i]['internallabel'] = '3rd Party'; - $app1[$i]['internalclass'] = 'externalapp'; - } - - - // rating img - if ($app['score'] < 5) { - $img = OC_Helper::imagePath( "core", "rating/s1.png" ); - } elseif ($app['score'] < 15) { - $img = OC_Helper::imagePath( "core", "rating/s2.png" ); - } elseif($app['score'] < 25) { - $img = OC_Helper::imagePath( "core", "rating/s3.png" ); - } elseif($app['score'] < 35) { - $img = OC_Helper::imagePath( "core", "rating/s4.png" ); - } elseif($app['score'] < 45) { - $img = OC_Helper::imagePath( "core", "rating/s5.png" ); - } elseif($app['score'] < 55) { - $img = OC_Helper::imagePath( "core", "rating/s6.png" ); - } elseif($app['score'] < 65) { - $img = OC_Helper::imagePath( "core", "rating/s7.png" ); - } elseif($app['score'] < 75) { - $img = OC_Helper::imagePath( "core", "rating/s8.png" ); - } elseif($app['score'] < 85) { - $img = OC_Helper::imagePath( "core", "rating/s9.png" ); - } elseif($app['score'] < 95) { - $img = OC_Helper::imagePath( "core", "rating/s10.png" ); - } elseif($app['score'] < 100) { - $img = OC_Helper::imagePath( "core", "rating/s11.png" ); - } - - $app1[$i]['score'] = '<img src="' . $img . '"> Score: ' . $app['score'] . '%'; - $i++; + $page = 0; + $remoteApps = OC_OCSClient::getApplications($categories, $page, $filter); + $app1 = array(); + $i = 0; + $l = \OC::$server->getL10N('core'); + foreach ($remoteApps as $app) { + $app1[$i] = $app; + $app1[$i]['author'] = $app['personid']; + $app1[$i]['ocs_id'] = $app['id']; + $app1[$i]['internal'] = $app1[$i]['active'] = 0; + $app1[$i]['update'] = false; + $app1[$i]['groups'] = false; + $app1[$i]['score'] = $app['score']; + $app1[$i]['removable'] = false; + if ($app['label'] == 'recommended') { + $app1[$i]['internallabel'] = $l->t('Recommended'); + $app1[$i]['internalclass'] = 'recommendedapp'; } + + $i++; } if (empty($app1)) { diff --git a/lib/private/installer.php b/lib/private/installer.php index 02e2190aaf2..cd1d8ce392f 100644 --- a/lib/private/installer.php +++ b/lib/private/installer.php @@ -201,11 +201,10 @@ class OC_Installer{ /** * update an app by it's id * @param integer $ocsid - * @param bool $isShipped * @return bool * @throws Exception */ - public static function updateAppByOCSId($ocsid, $isShipped=false) { + public static function updateAppByOCSId($ocsid) { $appdata = OC_OCSClient::getApplication($ocsid); $download = OC_OCSClient::getApplicationDownload($ocsid, 1); diff --git a/lib/private/ocsclient.php b/lib/private/ocsclient.php index dc147dea0c9..8ceb43f4c1f 100644 --- a/lib/private/ocsclient.php +++ b/lib/private/ocsclient.php @@ -142,9 +142,11 @@ class OC_OCSClient{ $app['license']=(string)$tmp[$i]->license; $app['detailpage']=(string)$tmp[$i]->detailpage; $app['preview']=(string)$tmp[$i]->smallpreviewpic1; + $app['preview-full']=(string)$tmp[$i]->previewpic1; $app['changed']=strtotime($tmp[$i]->changed); $app['description']=(string)$tmp[$i]->description; $app['score']=(string)$tmp[$i]->score; + $app['downloads'] = $tmp[$i]->downloads; $apps[]=$app; } |