Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
de920736
Commit
de920736
authored
11 years ago
by
Vincent Petry
Browse files
Options
Downloads
Plain Diff
Merge pull request #5320 from owncloud/fix_app_sorting
Fix app sorting
parents
f3336f88
258ccdfa
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/private/app.php
+33
-0
33 additions, 0 deletions
lib/private/app.php
settings/apps.php
+0
-17
0 additions, 17 deletions
settings/apps.php
with
33 additions
and
17 deletions
lib/private/app.php
+
33
−
0
View file @
de920736
...
@@ -752,9 +752,42 @@ class OC_App{
...
@@ -752,9 +752,42 @@ class OC_App{
}
else
{
}
else
{
$combinedApps
=
$appList
;
$combinedApps
=
$appList
;
}
}
// bring the apps into the right order with a custom sort funtion
usort
(
$combinedApps
,
'\OC_App::customSort'
);
return
$combinedApps
;
return
$combinedApps
;
}
}
/**
* @brief: Internal custom sort funtion to bring the app into the right order. Should only be called by listAllApps
* @return array
*/
private
static
function
customSort
(
$a
,
$b
)
{
// prio 1: active
if
(
$a
[
'active'
]
!=
$b
[
'active'
])
{
return
$b
[
'active'
]
-
$a
[
'active'
];
}
// prio 2: shipped
if
(
$a
[
'shipped'
]
!=
$b
[
'shipped'
])
{
$atemp
=
(
$a
[
'shipped'
]
==
true
?
1
:
0
);
$btemp
=
(
$b
[
'shipped'
]
==
true
?
1
:
0
);
return
(
$btemp
-
$atemp
);
}
// prio 3: recommended
if
(
$a
[
'internalclass'
]
!=
$b
[
'internalclass'
])
{
$atemp
=
(
$a
[
'internalclass'
]
==
'recommendedapp'
?
1
:
0
);
$btemp
=
(
$b
[
'internalclass'
]
==
'recommendedapp'
?
1
:
0
);
return
(
$btemp
-
$atemp
);
}
// prio 4: alphabetical
return
strcasecmp
(
$a
[
'name'
],
$b
[
'name'
]);
}
/**
/**
* @brief: get a list of all apps on apps.owncloud.com
* @brief: get a list of all apps on apps.owncloud.com
* @return array, multi-dimensional array of apps.
* @return array, multi-dimensional array of apps.
...
...
This diff is collapsed.
Click to expand it.
settings/apps.php
+
0
−
17
View file @
de920736
...
@@ -28,24 +28,7 @@ OC_App::loadApps();
...
@@ -28,24 +28,7 @@ OC_App::loadApps();
OC_Util
::
addStyle
(
"settings"
,
"settings"
);
OC_Util
::
addStyle
(
"settings"
,
"settings"
);
OC_App
::
setActiveNavigationEntry
(
"core_apps"
);
OC_App
::
setActiveNavigationEntry
(
"core_apps"
);
function
app_sort
(
$a
,
$b
)
{
if
(
$a
[
'active'
]
!==
$b
[
'active'
])
{
return
$b
[
'active'
]
-
$a
[
'active'
];
}
if
(
$a
[
'internal'
]
!==
$b
[
'internal'
])
{
return
$b
[
'internal'
]
-
$a
[
'internal'
];
}
return
strcmp
(
$a
[
'name'
],
$b
[
'name'
]);
}
$combinedApps
=
OC_App
::
listAllApps
();
$combinedApps
=
OC_App
::
listAllApps
();
usort
(
$combinedApps
,
'app_sort'
);
$tmpl
=
new
OC_Template
(
"settings"
,
"apps"
,
"user"
);
$tmpl
=
new
OC_Template
(
"settings"
,
"apps"
,
"user"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment