Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory
Commits
ef4aa1aa
Commit
ef4aa1aa
authored
7 years ago
by
Côme Chilliet
Browse files
Options
Download
Patches
Plain Diff
feat(management) Reorganize column classes
parent
2b28accb
dev
6342-update-the-locales-for-1-5
6344-template-issue-when-creating-a-template-with-empty-password-error-message-should-not-be-seen
6365-core-locking-mechanism-is-not-changing-the-mail-ressource-it-does-lock-the-mail-account
6365-core-when-lock-mechanism-is-trigger-the-user-should-not-be-editable-if-not-unlock
6378-orcid-test-method-is-wrong-and-break-orcid-saving
core-php8
master
fusiondirectory-1.5
fusiondirectory-1.4
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
include/management/class_managementListing.inc
+1
-1
include/management/class_managementListing.inc
include/management/columns/class_ActionsColumn.inc
+40
-0
include/management/columns/class_ActionsColumn.inc
include/management/columns/class_Column.inc
+1
-121
include/management/columns/class_Column.inc
include/management/columns/class_LinkColumn.inc
+38
-0
include/management/columns/class_LinkColumn.inc
include/management/columns/class_ObjectTypeColumn.inc
+43
-0
include/management/columns/class_ObjectTypeColumn.inc
include/management/columns/class_PropertiesColumn.inc
+87
-0
include/management/columns/class_PropertiesColumn.inc
with
210 additions
and
122 deletions
+210
-122
include/management/class_managementListing.inc
+
1
−
1
View file @
ef4aa1aa
...
@@ -207,7 +207,7 @@ class managementListing
...
@@ -207,7 +207,7 @@ class managementListing
new
ObjectTypeColumn
(),
new
ObjectTypeColumn
(),
new
LinkColumn
(
'sn'
,
'Last name'
),
new
LinkColumn
(
'sn'
,
'Last name'
),
new
LinkColumn
(
'givenName'
,
'First name'
),
new
LinkColumn
(
'givenName'
,
'First name'
),
new
String
Column
(
'uid'
,
'Login'
),
new
Column
(
'uid'
,
'Login'
),
new
PropertiesColumn
(
NULL
,
'Properties'
),
new
PropertiesColumn
(
NULL
,
'Properties'
),
new
ActionsColumn
(
NULL
,
'Actions'
),
new
ActionsColumn
(
NULL
,
'Actions'
),
);
);
...
...
This diff is collapsed.
Click to expand it.
include/management/columns/class_ActionsColumn.inc
0 → 100644
+
40
−
0
View file @
ef4aa1aa
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2017-2018 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*!
* \brief Column showing the actions available on the object
*/
class
ActionsColumn
extends
Column
{
function
isSortable
()
{
return
FALSE
;
}
function
getRowClasses
(
ListingEntry
$entry
)
{
return
$this
->
parent
->
parent
->
getActionRowClasses
(
$entry
);
}
function
renderCell
(
ListingEntry
$entry
)
{
return
$this
->
parent
->
parent
->
renderActionColumn
(
$entry
);
}
}
This diff is collapsed.
Click to expand it.
include/management/c
lass_management
Column.inc
→
include/management/c
olumns/class_
Column.inc
+
1
−
121
View file @
ef4aa1aa
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
/*!
/*!
* \brief Column base class
* \brief Column base class
*/
*/
class
String
Column
class
Column
{
{
protected
$attribute
;
protected
$attribute
;
protected
$label
;
protected
$label
;
...
@@ -161,123 +161,3 @@ class StringColumn
...
@@ -161,123 +161,3 @@ class StringColumn
}
}
}
}
}
}
class
LinkColumn
extends
StringColumn
{
function
renderCell
(
ListingEntry
$entry
)
{
$attribute
=
$this
->
attribute
;
if
(
isset
(
$this
->
templateAttribute
)
&&
$entry
->
isTemplate
())
{
$attribute
=
$this
->
templateAttribute
;
}
if
(
isset
(
$entry
[
$attribute
]))
{
return
'<a href="?plug='
.
$_GET
[
'plug'
]
.
'&PID='
.
$entry
->
getPid
()
.
'&act=listing_edit_'
.
$entry
->
row
.
'" title="'
.
$entry
->
dn
.
'">'
.
htmlentities
(
$entry
[
$attribute
],
ENT_COMPAT
,
'UTF-8'
)
.
'</a>'
;
}
else
{
return
' '
;
}
}
}
class
ObjectTypeColumn
extends
StringColumn
{
function
isSortable
()
{
return
FALSE
;
}
function
renderCell
(
ListingEntry
$entry
)
{
if
(
$entry
->
isTemplate
())
{
$infos
=
objects
::
infos
(
$entry
->
getTemplatedType
());
return
'<img title="'
.
$entry
->
dn
.
'" src="'
.
htmlentities
(
'geticon.php?context=devices&icon=template&size=16'
,
ENT_COMPAT
,
'UTF-8'
)
.
'" alt="'
.
sprintf
(
_
(
'%s template'
),
$infos
[
'name'
])
.
'"/>'
;
}
elseif
(
$entry
->
type
)
{
$infos
=
objects
::
infos
(
$entry
->
type
);
return
'<img title="'
.
$entry
->
dn
.
'" src="'
.
htmlentities
(
$infos
[
'icon'
],
ENT_COMPAT
,
'UTF-8'
)
.
'" alt="'
.
$infos
[
'name'
]
.
'"/>'
;
}
else
{
return
' '
;
}
}
}
class
ActionsColumn
extends
StringColumn
{
function
isSortable
()
{
return
FALSE
;
}
function
getRowClasses
(
ListingEntry
$entry
)
{
return
$this
->
parent
->
parent
->
getActionRowClasses
(
$entry
);
}
function
renderCell
(
ListingEntry
$entry
)
{
return
$this
->
parent
->
parent
->
renderActionColumn
(
$entry
);
}
}
class
PropertiesColumn
extends
StringColumn
{
function
isSortable
()
{
return
FALSE
;
}
function
fillNeededAttributes
(
array
&
$attrs
)
{
$attrs
[
'objectClass'
]
=
'*'
;
}
function
renderCell
(
ListingEntry
$entry
)
{
global
$config
;
$infos
=
objects
::
infos
(
$entry
->
getTemplatedType
());
static
$tabs
=
array
();
if
(
empty
(
$tabs
[
$entry
->
type
]))
{
$tabs
[
$entry
->
type
]
=
array
();
foreach
(
$config
->
data
[
'TABS'
][
$infos
[
'tabGroup'
]]
as
$plug
)
{
if
(
$plug
[
'CLASS'
]
==
$infos
[
'mainTab'
])
{
continue
;
}
if
(
class_available
(
$plug
[
'CLASS'
]))
{
$name
=
$plug
[
'CLASS'
];
$tabs
[
$entry
->
type
][
$name
]
=
new
$name
(
'new'
);
}
}
}
/* Main tab is always there */
$pInfos
=
pluglist
::
pluginInfos
(
$infos
[
'mainTab'
]);
$result
=
'<input type="image" src="'
.
htmlentities
(
$pInfos
[
'plSmallIcon'
],
ENT_COMPAT
,
'UTF-8'
)
.
'" '
.
'alt="'
.
$pInfos
[
'plShortName'
]
.
'" title="'
.
$pInfos
[
'plShortName'
]
.
'" '
.
'name="listing_edit_tab_'
.
$infos
[
'mainTab'
]
.
'_'
.
$entry
->
row
.
'"/>'
;
if
(
!
empty
(
$entry
))
{
if
(
$entry
->
isTemplate
())
{
$attrs
=
$entry
->
getTemplatedFields
();
}
else
{
$attrs
=
$entry
;
}
foreach
(
$tabs
[
$entry
->
type
]
as
$class
=>
$tab
)
{
if
(
$tab
->
is_this_account
(
$attrs
))
{
$pInfos
=
pluglist
::
pluginInfos
(
$class
);
if
(
isset
(
$pInfos
[
'plSmallIcon'
]))
{
$result
.
=
'<input type="image" src="'
.
htmlentities
(
$pInfos
[
'plSmallIcon'
],
ENT_COMPAT
,
'UTF-8'
)
.
'" '
.
'alt="'
.
$pInfos
[
'plShortName'
]
.
'" title="'
.
$pInfos
[
'plShortName'
]
.
'" '
.
'name="listing_edit_tab_'
.
$class
.
'_'
.
$entry
->
row
.
'"/>'
;
}
else
{
@
DEBUG
(
DEBUG_TRACE
,
__LINE__
,
__FUNCTION__
,
__FILE__
,
$pInfos
[
'plShortName'
]
.
" (
$class
)"
,
'No icon for'
);
}
}
else
{
$result
.
=
'<img src="images/empty.png" alt="" class="optional '
.
$class
.
'"/>'
;
}
}
}
return
$result
;
}
}
This diff is collapsed.
Click to expand it.
include/management/columns/class_LinkColumn.inc
0 → 100644
+
38
−
0
View file @
ef4aa1aa
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2017-2018 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*!
* \brief Column rendering a link to edit the object
*/
class
LinkColumn
extends
Column
{
function
renderCell
(
ListingEntry
$entry
)
{
$attribute
=
$this
->
attribute
;
if
(
isset
(
$this
->
templateAttribute
)
&&
$entry
->
isTemplate
())
{
$attribute
=
$this
->
templateAttribute
;
}
if
(
isset
(
$entry
[
$attribute
]))
{
return
'<a href="?plug='
.
$_GET
[
'plug'
]
.
'&PID='
.
$entry
->
getPid
()
.
'&act=listing_edit_'
.
$entry
->
row
.
'" title="'
.
$entry
->
dn
.
'">'
.
htmlentities
(
$entry
[
$attribute
],
ENT_COMPAT
,
'UTF-8'
)
.
'</a>'
;
}
else
{
return
' '
;
}
}
}
This diff is collapsed.
Click to expand it.
include/management/columns/class_ObjectTypeColumn.inc
0 → 100644
+
43
−
0
View file @
ef4aa1aa
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2017-2018 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*!
* \brief Column showing the icon of the objectType
*/
class
ObjectTypeColumn
extends
Column
{
function
isSortable
()
{
return
FALSE
;
}
function
renderCell
(
ListingEntry
$entry
)
{
if
(
$entry
->
isTemplate
())
{
$infos
=
objects
::
infos
(
$entry
->
getTemplatedType
());
return
'<img title="'
.
$entry
->
dn
.
'" src="'
.
htmlentities
(
'geticon.php?context=devices&icon=template&size=16'
,
ENT_COMPAT
,
'UTF-8'
)
.
'" alt="'
.
sprintf
(
_
(
'%s template'
),
$infos
[
'name'
])
.
'"/>'
;
}
elseif
(
$entry
->
type
)
{
$infos
=
objects
::
infos
(
$entry
->
type
);
return
'<img title="'
.
$entry
->
dn
.
'" src="'
.
htmlentities
(
$infos
[
'icon'
],
ENT_COMPAT
,
'UTF-8'
)
.
'" alt="'
.
$infos
[
'name'
]
.
'"/>'
;
}
else
{
return
' '
;
}
}
}
This diff is collapsed.
Click to expand it.
include/management/columns/class_PropertiesColumn.inc
0 → 100644
+
87
−
0
View file @
ef4aa1aa
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2017-2018 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*!
* \brief Column showing the activated tabs of the object
*/
class
PropertiesColumn
extends
Column
{
function
isSortable
()
{
return
FALSE
;
}
function
fillNeededAttributes
(
array
&
$attrs
)
{
$attrs
[
'objectClass'
]
=
'*'
;
}
function
renderCell
(
ListingEntry
$entry
)
{
global
$config
;
$infos
=
objects
::
infos
(
$entry
->
getTemplatedType
());
static
$tabs
=
array
();
if
(
empty
(
$tabs
[
$entry
->
type
]))
{
$tabs
[
$entry
->
type
]
=
array
();
foreach
(
$config
->
data
[
'TABS'
][
$infos
[
'tabGroup'
]]
as
$plug
)
{
if
(
$plug
[
'CLASS'
]
==
$infos
[
'mainTab'
])
{
continue
;
}
if
(
class_available
(
$plug
[
'CLASS'
]))
{
$name
=
$plug
[
'CLASS'
];
$tabs
[
$entry
->
type
][
$name
]
=
new
$name
(
'new'
);
}
}
}
/* Main tab is always there */
$pInfos
=
pluglist
::
pluginInfos
(
$infos
[
'mainTab'
]);
$result
=
'<input type="image" src="'
.
htmlentities
(
$pInfos
[
'plSmallIcon'
],
ENT_COMPAT
,
'UTF-8'
)
.
'" '
.
'alt="'
.
$pInfos
[
'plShortName'
]
.
'" title="'
.
$pInfos
[
'plShortName'
]
.
'" '
.
'name="listing_edit_tab_'
.
$infos
[
'mainTab'
]
.
'_'
.
$entry
->
row
.
'"/>'
;
if
(
!
empty
(
$entry
))
{
if
(
$entry
->
isTemplate
())
{
$attrs
=
$entry
->
getTemplatedFields
();
}
else
{
$attrs
=
$entry
;
}
foreach
(
$tabs
[
$entry
->
type
]
as
$class
=>
$tab
)
{
if
(
$tab
->
is_this_account
(
$attrs
))
{
$pInfos
=
pluglist
::
pluginInfos
(
$class
);
if
(
isset
(
$pInfos
[
'plSmallIcon'
]))
{
$result
.
=
'<input type="image" src="'
.
htmlentities
(
$pInfos
[
'plSmallIcon'
],
ENT_COMPAT
,
'UTF-8'
)
.
'" '
.
'alt="'
.
$pInfos
[
'plShortName'
]
.
'" title="'
.
$pInfos
[
'plShortName'
]
.
'" '
.
'name="listing_edit_tab_'
.
$class
.
'_'
.
$entry
->
row
.
'"/>'
;
}
else
{
@
DEBUG
(
DEBUG_TRACE
,
__LINE__
,
__FUNCTION__
,
__FILE__
,
$pInfos
[
'plShortName'
]
.
" (
$class
)"
,
'No icon for'
);
}
}
else
{
$result
.
=
'<img src="images/empty.png" alt="" class="optional '
.
$class
.
'"/>'
;
}
}
}
return
$result
;
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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
Menu
Explore
Projects
Groups
Topics
Snippets