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
272fc252
Commit
272fc252
authored
14 years ago
by
Jakob Sack
Browse files
Options
Downloads
Patches
Plain Diff
Activate "active" for subentries
parent
05637416
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/app.php
+45
-36
45 additions, 36 deletions
lib/app.php
templates/layout.admin.php
+2
-2
2 additions, 2 deletions
templates/layout.admin.php
with
47 additions
and
38 deletions
lib/app.php
+
45
−
36
View file @
272fc252
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
class
OC_APP
{
class
OC_APP
{
static
private
$init
=
false
;
static
private
$init
=
false
;
static
private
$apps
=
array
();
static
private
$apps
=
array
();
static
private
$activeapp
=
""
;
static
private
$activeapp
=
''
;
static
private
$adminpages
=
array
();
static
private
$adminpages
=
array
();
static
private
$settingspages
=
array
();
static
private
$settingspages
=
array
();
static
private
$navigation
=
array
();
static
private
$navigation
=
array
();
...
@@ -52,16 +52,16 @@ class OC_APP{
...
@@ -52,16 +52,16 @@ class OC_APP{
}
}
// Our very own core apps are hardcoded
// Our very own core apps are hardcoded
foreach
(
array
(
"
admin
"
,
"
files
"
,
"
log
"
,
"
help
"
,
"
settings
"
)
as
$app
){
foreach
(
array
(
'
admin
'
,
'
files
'
,
'
log
'
,
'
help
'
,
'
settings
'
)
as
$app
){
require
(
"
$app
/appinfo/app.php
"
);
require
(
$app
.
'
/appinfo/app.php
'
);
}
}
// The rest comes here
// The rest comes here
$apps
=
OC_APPCONFIG
::
getApps
();
$apps
=
OC_APPCONFIG
::
getApps
();
foreach
(
$apps
as
$app
){
foreach
(
$apps
as
$app
){
if
(
self
::
isEnabled
(
$app
)){
if
(
self
::
isEnabled
(
$app
)){
if
(
is_file
(
$SERVERROOT
.
"
/apps/
$app
/appinfo/app.php
"
)){
if
(
is_file
(
$SERVERROOT
.
'
/apps/
'
.
$app
.
'
/appinfo/app.php
'
)){
require
(
"
apps/
$app
/appinfo/app.php
"
);
require
(
'
apps/
'
.
$app
.
'
/appinfo/app.php
'
);
}
}
}
}
}
}
...
@@ -116,8 +116,8 @@ class OC_APP{
...
@@ -116,8 +116,8 @@ class OC_APP{
*
*
* This function registers the application. $data is an associative array.
* This function registers the application. $data is an associative array.
* The following keys are required:
* The following keys are required:
* - id: id of the application, has to be unique (
"
addressbook
"
)
* - id: id of the application, has to be unique (
'
addressbook
'
)
* - name: Human readable name (
"
Addressbook
"
)
* - name: Human readable name (
'
Addressbook
'
)
* - version: array with Version (major, minor, bugfix) ( array(1, 0, 2))
* - version: array with Version (major, minor, bugfix) ( array(1, 0, 2))
*
*
* The following keys are optional:
* The following keys are optional:
...
@@ -148,9 +148,9 @@ class OC_APP{
...
@@ -148,9 +148,9 @@ class OC_APP{
* This function adds a new entry to the navigation visible to users. $data
* This function adds a new entry to the navigation visible to users. $data
* is an associative array.
* is an associative array.
* The following keys are required:
* The following keys are required:
* - id: unique id for this entry (
"
addressbook_index
"
)
* - id: unique id for this entry (
'
addressbook_index
'
)
* - href: link to the page
* - href: link to the page
* - name: Human readable name (
"
Addressbook
"
)
* - name: Human readable name (
'
Addressbook
'
)
*
*
* The following keys are optional:
* The following keys are optional:
* - icon: path to the icon of the app
* - icon: path to the icon of the app
...
@@ -174,9 +174,9 @@ class OC_APP{
...
@@ -174,9 +174,9 @@ class OC_APP{
* as being active (see activateNavigationEntry()). $data is an associative
* as being active (see activateNavigationEntry()). $data is an associative
* array.
* array.
* The following keys are required:
* The following keys are required:
* - id: unique id for this entry (
"
addressbook_index
"
)
* - id: unique id for this entry (
'
addressbook_index
'
)
* - href: link to the page
* - href: link to the page
* - name: Human readable name (
"
Addressbook
"
)
* - name: Human readable name (
'
Addressbook
'
)
*
*
* The following keys are optional:
* The following keys are optional:
* - icon: path to the icon of the app
* - icon: path to the icon of the app
...
@@ -196,7 +196,7 @@ class OC_APP{
...
@@ -196,7 +196,7 @@ class OC_APP{
* @param $id id of the entry
* @param $id id of the entry
* @returns true/false
* @returns true/false
*
*
* This function sets a navigation entry as active and removes the
"
active
"
* This function sets a navigation entry as active and removes the
'
active
'
* property from all other entries. The templates can use this for
* property from all other entries. The templates can use this for
* highlighting the current position of the user.
* highlighting the current position of the user.
*/
*/
...
@@ -224,9 +224,9 @@ class OC_APP{
...
@@ -224,9 +224,9 @@ class OC_APP{
* This function registers a admin page that will be shown in the admin
* This function registers a admin page that will be shown in the admin
* menu. $data is an associative array.
* menu. $data is an associative array.
* The following keys are required:
* The following keys are required:
* - id: unique id for this entry (
"
files_admin
"
)
* - id: unique id for this entry (
'
files_admin
'
)
* - href: link to the admin page
* - href: link to the admin page
* - name: Human readable name (
"
Files Administration
"
)
* - name: Human readable name (
'
Files Administration
'
)
*
*
* The following keys are optional:
* The following keys are optional:
* - order: integer, that influences the position of your application in
* - order: integer, that influences the position of your application in
...
@@ -245,16 +245,16 @@ class OC_APP{
...
@@ -245,16 +245,16 @@ class OC_APP{
*
*
* This function registers a settings page. $data is an associative array.
* This function registers a settings page. $data is an associative array.
* The following keys are required:
* The following keys are required:
* - app: app the settings belong to (
"
files
"
)
* - app: app the settings belong to (
'
files
'
)
* - id: unique id for this entry (
"
files_public
"
)
* - id: unique id for this entry (
'
files_public
'
)
* - href: link to the admin page
* - href: link to the admin page
* - name: Human readable name (
"
Public files
"
)
* - name: Human readable name (
'
Public files
'
)
*
*
* The following keys are optional:
* The following keys are optional:
* - order: integer, that influences the position of your application in
* - order: integer, that influences the position of your application in
* the list. Lower values come first.
* the list. Lower values come first.
*
*
* For the main settings page of an app, the keys
"
app
"
and
"
id
"
have to be
* For the main settings page of an app, the keys
'
app
'
and
'
id
'
have to be
* the same.
* the same.
*/
*/
public
static
function
addSettingsPage
(
$data
=
array
()){
public
static
function
addSettingsPage
(
$data
=
array
()){
...
@@ -268,11 +268,11 @@ class OC_APP{
...
@@ -268,11 +268,11 @@ class OC_APP{
* @returns associative array
* @returns associative array
*
*
* This function returns an array containing all entries added. The
* This function returns an array containing all entries added. The
* entries are sorted by the key
"
order
"
ascending. Additional to the keys
* entries are sorted by the key
'
order
'
ascending. Additional to the keys
* given for each app the following keys exist:
* given for each app the following keys exist:
* - active: boolean, signals if the user is on this navigation entry
* - active: boolean, signals if the user is on this navigation entry
* - children: array that is empty if the key
"
active
"
is false or
* - children: array that is empty if the key
'
active
'
is false or
* contains the subentries if the key
"
active
"
is true
* contains the subentries if the key
'
active
'
is true
*/
*/
public
static
function
getNavigation
(){
public
static
function
getNavigation
(){
$navigation
=
self
::
proceedNavigation
(
self
::
$navigation
);
$navigation
=
self
::
proceedNavigation
(
self
::
$navigation
);
...
@@ -285,7 +285,7 @@ class OC_APP{
...
@@ -285,7 +285,7 @@ class OC_APP{
* @returns associative array
* @returns associative array
*
*
* This function returns an array containing all settings pages added. The
* This function returns an array containing all settings pages added. The
* entries are sorted by the key
"
order
"
ascending.
* entries are sorted by the key
'
order
'
ascending.
*/
*/
public
static
function
getSettingsNavigation
(){
public
static
function
getSettingsNavigation
(){
$navigation
=
self
::
proceedNavigation
(
self
::
$settingspages
);
$navigation
=
self
::
proceedNavigation
(
self
::
$settingspages
);
...
@@ -299,7 +299,7 @@ class OC_APP{
...
@@ -299,7 +299,7 @@ class OC_APP{
* @returns associative array
* @returns associative array
*
*
* This function returns an array containing all admin pages added. The
* This function returns an array containing all admin pages added. The
* entries are sorted by the key
"
order
"
ascending.
* entries are sorted by the key
'
order
'
ascending.
*/
*/
public
static
function
getAdminNavigation
(){
public
static
function
getAdminNavigation
(){
$navigation
=
self
::
proceedNavigation
(
self
::
$adminpages
);
$navigation
=
self
::
proceedNavigation
(
self
::
$adminpages
);
...
@@ -313,38 +313,47 @@ class OC_APP{
...
@@ -313,38 +313,47 @@ class OC_APP{
$found
=
false
;
$found
=
false
;
foreach
(
self
::
$subnavigation
as
$parent
=>
$selection
){
foreach
(
self
::
$subnavigation
as
$parent
=>
$selection
){
foreach
(
$selection
as
$subentry
){
foreach
(
$selection
as
$subentry
){
if
(
$subentry
[
"
id
"
]
==
self
::
$activeapp
){
if
(
$subentry
[
'
id
'
]
==
self
::
$activeapp
){
foreach
(
$list
as
&
$naventry
){
foreach
(
$list
as
&
$naventry
){
if
(
$naventry
[
"
id
"
]
==
$parent
){
if
(
$naventry
[
'
id
'
]
==
$parent
){
$naventry
[
"
active
"
]
=
true
;
$naventry
[
'
active
'
]
=
true
;
$naventry
[
"
subnavigation
"
]
=
$selection
;
$naventry
[
'
subnavigation
'
]
=
$selection
;
}
}
else
{
else
{
$naventry
[
"active"
]
=
false
;
$naventry
[
'active'
]
=
false
;
}
}
}
}
unset
(
$naventry
);
$found
=
true
;
$found
=
true
;
}
}
}
}
}
}
// Mark subentry as active
foreach
(
$list
as
&
$naventry
){
if
(
$naventry
[
'active'
]
){
foreach
(
$naventry
[
'subnavigation'
]
as
&
$subnaventry
){
$subnaventry
[
'active'
]
=
$subnaventry
[
'id'
]
==
self
::
$activeapp
?
true
:
false
;
}
unset
(
$subnaventry
);
}
}
unset
(
$naventry
);
return
$list
;
return
$list
;
}
}
/// This is private as well. It simply works, so don't ask for more details
/// This is private as well. It simply works, so don't ask for more details
private
static
function
proceedNavigation
(
$list
){
private
static
function
proceedNavigation
(
$list
){
foreach
(
$list
as
&
$naventry
){
foreach
(
$list
as
&
$naventry
){
$naventry
[
"
subnavigation
"
]
=
array
();
$naventry
[
'
subnavigation
'
]
=
array
();
if
(
$naventry
[
"
id
"
]
==
self
::
$activeapp
){
if
(
$naventry
[
'
id
'
]
==
self
::
$activeapp
){
$naventry
[
"
active
"
]
=
true
;
$naventry
[
'
active
'
]
=
true
;
if
(
array_key_exists
(
$naventry
[
"
id
"
],
self
::
$subnavigation
)){
if
(
array_key_exists
(
$naventry
[
'
id
'
],
self
::
$subnavigation
)){
$naventry
[
"
subnavigation
"
]
=
self
::
$subnavigation
[
$naventry
[
"
id
"
]];
$naventry
[
'
subnavigation
'
]
=
self
::
$subnavigation
[
$naventry
[
'
id
'
]];
}
}
}
}
else
{
else
{
$naventry
[
"active"
]
=
false
;
$naventry
[
'active'
]
=
false
;
}
}
}
}
unset
(
$naventry
);
usort
(
$list
,
create_function
(
'$a, $b'
,
'if( $a["order"] == $b["order"] ){return 0;}elseif( $a["order"] < $b["order"] ){return -1;}else{return 1;}'
));
usort
(
$list
,
create_function
(
'$a, $b'
,
'if( $a["order"] == $b["order"] ){return 0;}elseif( $a["order"] < $b["order"] ){return -1;}else{return 1;}'
));
...
...
This diff is collapsed.
Click to expand it.
templates/layout.admin.php
+
2
−
2
View file @
272fc252
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
<li><a
style=
"background-image:url(
<?php
echo
$entry
[
'icon'
];
?>
)"
href=
"
<?php
echo
$entry
[
'href'
];
?>
"
title=
""
<?php
if
(
$entry
[
"active"
]
)
:
?>
class=
"active"
<?php
endif
;
?>
>
<?php
echo
$entry
[
'name'
]
?>
</a></li>
<li><a
style=
"background-image:url(
<?php
echo
$entry
[
'icon'
];
?>
)"
href=
"
<?php
echo
$entry
[
'href'
];
?>
"
title=
""
<?php
if
(
$entry
[
"active"
]
)
:
?>
class=
"active"
<?php
endif
;
?>
>
<?php
echo
$entry
[
'name'
]
?>
</a></li>
<?php
if
(
sizeof
(
$entry
[
"subnavigation"
]
))
:
?>
<?php
if
(
sizeof
(
$entry
[
"subnavigation"
]
))
:
?>
<?php
foreach
(
$entry
[
"subnavigation"
]
as
$subentry
)
:
?>
<?php
foreach
(
$entry
[
"subnavigation"
]
as
$subentry
)
:
?>
<li><a
style=
"background-color:#FF8800;"
href=
"
<?php
echo
$subentry
[
'href'
];
?>
"
title=
""
>
<?php
echo
$subentry
[
'name'
]
?>
</a></li>
<li><a
style=
"background-color:#FF8800;"
href=
"
<?php
echo
$subentry
[
'href'
];
?>
"
title=
""
<?php
if
(
$subentry
[
"active"
]
)
:
?>
class=
"active"
<?php
endif
;
?>
>
<?php
echo
$subentry
[
'name'
]
?>
</a></li>
<?php
endforeach
;
?>
<?php
endforeach
;
?>
<?php
endif
;
?>
<?php
endif
;
?>
<?php
endforeach
;
?>
<?php
endforeach
;
?>
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
<li><a
style=
"background-image:url(
<?php
echo
$entry
[
'icon'
];
?>
)"
href=
"
<?php
echo
$entry
[
'href'
];
?>
"
title=
""
<?php
if
(
$entry
[
"active"
]
)
:
?>
class=
"active"
<?php
endif
;
?>
>
<?php
echo
$entry
[
'name'
]
?>
</a></li>
<li><a
style=
"background-image:url(
<?php
echo
$entry
[
'icon'
];
?>
)"
href=
"
<?php
echo
$entry
[
'href'
];
?>
"
title=
""
<?php
if
(
$entry
[
"active"
]
)
:
?>
class=
"active"
<?php
endif
;
?>
>
<?php
echo
$entry
[
'name'
]
?>
</a></li>
<?php
if
(
sizeof
(
$entry
[
"subnavigation"
]
))
:
?>
<?php
if
(
sizeof
(
$entry
[
"subnavigation"
]
))
:
?>
<?php
foreach
(
$entry
[
"subnavigation"
]
as
$subentry
)
:
?>
<?php
foreach
(
$entry
[
"subnavigation"
]
as
$subentry
)
:
?>
<li><a
style=
"background-color:#FF8800;"
href=
"
<?php
echo
$subentry
[
'href'
];
?>
"
title=
""
>
<?php
echo
$subentry
[
'name'
]
?>
</a></li>
<li><a
style=
"background-color:#FF8800;"
href=
"
<?php
echo
$subentry
[
'href'
];
?>
"
title=
""
>
<?php
echo
$subentry
[
'name'
]
?>
<?php
if
(
$subentry
[
"active"
]
)
:
?>
active
<?php
endif
;
?>
</a></li>
<?php
endforeach
;
?>
<?php
endforeach
;
?>
<?php
endif
;
?>
<?php
endif
;
?>
<?php
endforeach
;
?>
<?php
endforeach
;
?>
...
...
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