translate GID -> group name, layout changes
This commit is contained in:
parent
c86ba0d1d4
commit
b1b76ea3ae
|
@ -179,12 +179,10 @@ if (! $_GET['norefresh']) {
|
||||||
$dom_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_DomainSuffix());
|
$dom_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_DomainSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
echo ("<p align=\"left\">\n");
|
|
||||||
echo ("<input type=\"submit\" name=\"new_domain\" value=\"" . _("New Domain") . "\">\n");
|
|
||||||
if (sizeof($dom_info) > 0) echo ("<input type=\"submit\" name=\"del_domain\" value=\"" . _("Delete Domain(s)") . "\">\n");
|
|
||||||
// print combobox with possible sub-DNs
|
// print combobox with possible sub-DNs
|
||||||
if (sizeof($dom_units) > 1) {
|
if (sizeof($dom_units) > 1) {
|
||||||
echo (" <b>" . _("Suffix") . ": </b>");
|
echo ("<p align=\"left\">\n");
|
||||||
|
echo ("<b>" . _("Suffix") . ": </b>");
|
||||||
echo ("<select size=1 name=\"dom_suffix\">\n");
|
echo ("<select size=1 name=\"dom_suffix\">\n");
|
||||||
for ($i = 0; $i < sizeof($dom_units); $i++) {
|
for ($i = 0; $i < sizeof($dom_units); $i++) {
|
||||||
if ($dom_suffix == $dom_units[$i]) echo ("<option selected>" . $dom_units[$i] . "</option>\n");
|
if ($dom_suffix == $dom_units[$i]) echo ("<option selected>" . $dom_units[$i] . "</option>\n");
|
||||||
|
@ -192,8 +190,15 @@ for ($i = 0; $i < sizeof($dom_units); $i++) {
|
||||||
}
|
}
|
||||||
echo ("</select>\n");
|
echo ("</select>\n");
|
||||||
echo ("<input type=\"submit\" name=\"refresh\" value=\"" . _("Change Suffix") . "\">");
|
echo ("<input type=\"submit\" name=\"refresh\" value=\"" . _("Change Suffix") . "\">");
|
||||||
}
|
|
||||||
echo ("</p>\n");
|
echo ("</p>\n");
|
||||||
|
echo ("<p> </p>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo ("<p align=\"left\">\n");
|
||||||
|
echo ("<input type=\"submit\" name=\"new_domain\" value=\"" . _("New Domain") . "\">\n");
|
||||||
|
if (sizeof($dom_info) > 0) echo ("<input type=\"submit\" name=\"del_domain\" value=\"" . _("Delete Domain(s)") . "\">\n");
|
||||||
|
echo ("</p>\n");
|
||||||
|
|
||||||
echo ("</form>\n");
|
echo ("</form>\n");
|
||||||
echo "</body></html>\n";
|
echo "</body></html>\n";
|
||||||
|
|
||||||
|
|
|
@ -234,12 +234,10 @@ if (! $_GET['norefresh']) {
|
||||||
$grp_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_GroupSuffix());
|
$grp_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_GroupSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
echo ("<p align=\"left\">\n");
|
|
||||||
echo ("<input type=\"submit\" name=\"new_group\" value=\"" . _("New Group") . "\">\n");
|
|
||||||
if (sizeof($grp_info) > 0) echo ("<input type=\"submit\" name=\"del_group\" value=\"" . _("Delete Group(s)") . "\">\n");
|
|
||||||
// print combobox with possible sub-DNs
|
// print combobox with possible sub-DNs
|
||||||
if (sizeof($grp_units) > 1) {
|
if (sizeof($grp_units) > 1) {
|
||||||
echo (" <b>" . _("Suffix") . ": </b>");
|
echo ("<p align=\"left\">\n");
|
||||||
|
echo ("<b>" . _("Suffix") . ": </b>");
|
||||||
echo ("<select size=1 name=\"grp_suffix\">\n");
|
echo ("<select size=1 name=\"grp_suffix\">\n");
|
||||||
for ($i = 0; $i < sizeof($grp_units); $i++) {
|
for ($i = 0; $i < sizeof($grp_units); $i++) {
|
||||||
if ($grp_suffix == $grp_units[$i]) echo ("<option selected>" . $grp_units[$i] . "</option>\n");
|
if ($grp_suffix == $grp_units[$i]) echo ("<option selected>" . $grp_units[$i] . "</option>\n");
|
||||||
|
@ -247,8 +245,15 @@ for ($i = 0; $i < sizeof($grp_units); $i++) {
|
||||||
}
|
}
|
||||||
echo ("</select>\n");
|
echo ("</select>\n");
|
||||||
echo ("<input type=\"submit\" name=\"refresh\" value=\"" . _("Change Suffix") . "\">");
|
echo ("<input type=\"submit\" name=\"refresh\" value=\"" . _("Change Suffix") . "\">");
|
||||||
}
|
|
||||||
echo ("</p>\n");
|
echo ("</p>\n");
|
||||||
|
echo ("<p> </p>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo ("<p align=\"left\">\n");
|
||||||
|
echo ("<input type=\"submit\" name=\"new_group\" value=\"" . _("New Group") . "\">\n");
|
||||||
|
if (sizeof($grp_info) > 0) echo ("<input type=\"submit\" name=\"del_group\" value=\"" . _("Delete Group(s)") . "\">\n");
|
||||||
|
echo ("</p>\n");
|
||||||
|
|
||||||
echo ("</form>\n");
|
echo ("</form>\n");
|
||||||
echo "</body></html>\n";
|
echo "</body></html>\n";
|
||||||
|
|
||||||
|
|
|
@ -226,12 +226,10 @@ if (! $_GET['norefresh']) {
|
||||||
$hst_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_HostSuffix());
|
$hst_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_HostSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
echo ("<p align=\"left\">\n");
|
|
||||||
echo ("<input type=\"submit\" name=\"new_host\" value=\"" . _("New Host") . "\">\n");
|
|
||||||
if (sizeof($hst_info) > 0) echo ("<input type=\"submit\" name=\"del_host\" value=\"" . _("Delete Host(s)") . "\">\n");
|
|
||||||
// print combobox with possible sub-DNs
|
// print combobox with possible sub-DNs
|
||||||
if (sizeof($hst_units) > 1) {
|
if (sizeof($hst_units) > 1) {
|
||||||
echo (" <b>" . _("Suffix") . ": </b>");
|
echo ("<p align=\"left\">\n");
|
||||||
|
echo ("<b>" . _("Suffix") . ": </b>");
|
||||||
echo ("<select size=1 name=\"hst_suffix\">\n");
|
echo ("<select size=1 name=\"hst_suffix\">\n");
|
||||||
for ($i = 0; $i < sizeof($hst_units); $i++) {
|
for ($i = 0; $i < sizeof($hst_units); $i++) {
|
||||||
if ($hst_suffix == $hst_units[$i]) echo ("<option selected>" . $hst_units[$i] . "</option>\n");
|
if ($hst_suffix == $hst_units[$i]) echo ("<option selected>" . $hst_units[$i] . "</option>\n");
|
||||||
|
@ -239,8 +237,15 @@ for ($i = 0; $i < sizeof($hst_units); $i++) {
|
||||||
}
|
}
|
||||||
echo ("</select>\n");
|
echo ("</select>\n");
|
||||||
echo ("<input type=\"submit\" name=\"refresh\" value=\"" . _("Change Suffix") . "\">");
|
echo ("<input type=\"submit\" name=\"refresh\" value=\"" . _("Change Suffix") . "\">");
|
||||||
}
|
|
||||||
echo ("</p>\n");
|
echo ("</p>\n");
|
||||||
|
echo ("<p> </p>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo ("<p align=\"left\">\n");
|
||||||
|
echo ("<input type=\"submit\" name=\"new_host\" value=\"" . _("New Host") . "\">\n");
|
||||||
|
if (sizeof($hst_info) > 0) echo ("<input type=\"submit\" name=\"del_host\" value=\"" . _("Delete Host(s)") . "\">\n");
|
||||||
|
echo ("</p>\n");
|
||||||
|
|
||||||
echo ("</form>\n");
|
echo ("</form>\n");
|
||||||
echo "</body></html>\n";
|
echo "</body></html>\n";
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,28 @@ setlanguage();
|
||||||
// copy HTTP-GET variables to HTTP-POST
|
// copy HTTP-GET variables to HTTP-POST
|
||||||
$_POST = $_POST + $_GET;
|
$_POST = $_POST + $_GET;
|
||||||
|
|
||||||
|
// check if primary group should be translated
|
||||||
|
if ($_POST['trans_primary'] == "on") $trans_primary = "on";
|
||||||
|
else $trans_primary = "off";
|
||||||
|
$trans_primary_hash = $_SESSION['trans_primary_hash'];
|
||||||
|
// generate hash table for group translation
|
||||||
|
if ($trans_primary == "on" && !$_GET["norefresh"]) {
|
||||||
|
$trans_primary_hash = array();
|
||||||
|
$suffix = $_SESSION['config']->get_groupSuffix();
|
||||||
|
$filter = "objectClass=posixGroup";
|
||||||
|
$attrs = array("cn", "gidNumber");
|
||||||
|
$sr = @ldap_search($_SESSION["ldap"]->server(), $suffix, $filter, $attrs);
|
||||||
|
if ($sr) {
|
||||||
|
$info = @ldap_get_entries($_SESSION["ldap"]->server(), $sr);
|
||||||
|
array_shift($info); // delete count entry
|
||||||
|
for ($i = 0; $i < sizeof($info); $i++) {
|
||||||
|
$trans_primary_hash[$info[$i]['gidnumber'][0]] = $info[$i]['cn'][0];
|
||||||
|
}
|
||||||
|
$_SESSION['trans_primary_hash'] = $trans_primary_hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$usr_units = $_SESSION['usr_units'];
|
$usr_units = $_SESSION['usr_units'];
|
||||||
|
|
||||||
// check if button was pressed and if we have to add/delete a user
|
// check if button was pressed and if we have to add/delete a user
|
||||||
|
@ -62,22 +84,21 @@ echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../../style/layout.css\"
|
||||||
echo "</head><body>\n";
|
echo "</head><body>\n";
|
||||||
echo "<script src=\"../../lib/functions.js\" type=\"text/javascript\" language=\"javascript\"></script>\n";
|
echo "<script src=\"../../lib/functions.js\" type=\"text/javascript\" language=\"javascript\"></script>\n";
|
||||||
|
|
||||||
|
$page = $_GET["page"];
|
||||||
|
if (!$page) $page = 1;
|
||||||
|
|
||||||
|
// take maximum count of user entries shown on one page out of session
|
||||||
|
if ($_SESSION["config"]->get_MaxListEntries() <= 0) {
|
||||||
|
$max_pageentrys = 10; // default setting, if not yet set
|
||||||
|
}
|
||||||
|
else $max_pageentrys = $_SESSION["config"]->get_MaxListEntries();
|
||||||
|
|
||||||
// generate attribute-description table
|
// generate attribute-description table
|
||||||
$attr_array = array(); // list of LDAP attributes to show
|
$attr_array = array(); // list of LDAP attributes to show
|
||||||
$desc_array = array(); // list of descriptions for the attributes
|
$desc_array = array(); // list of descriptions for the attributes
|
||||||
$attr_string = $_SESSION["config"]->get_userlistAttributes();
|
$attr_string = $_SESSION["config"]->get_userlistAttributes();
|
||||||
$temp_array = explode(";", $attr_string);
|
$temp_array = explode(";", $attr_string);
|
||||||
$hash_table = $_SESSION["ldap"]->attributeUserArray();
|
$hash_table = $_SESSION["ldap"]->attributeUserArray();
|
||||||
$page = $_GET["page"];
|
|
||||||
if (!$page)
|
|
||||||
$page = 1;
|
|
||||||
|
|
||||||
// take maximum count of user entries shown on one page out of session
|
|
||||||
if ($_SESSION["config"]->get_MaxListEntries() <= 0)
|
|
||||||
$max_pageentrys = 10; // default setting, if not yet set
|
|
||||||
else
|
|
||||||
$max_pageentrys = $_SESSION["config"]->get_MaxListEntries();
|
|
||||||
|
|
||||||
|
|
||||||
// generate column attributes and descriptions
|
// generate column attributes and descriptions
|
||||||
for ($i = 0; $i < sizeof($temp_array); $i++) {
|
for ($i = 0; $i < sizeof($temp_array); $i++) {
|
||||||
|
@ -187,7 +208,7 @@ if ($user_count != 0) {
|
||||||
else
|
else
|
||||||
echo "<th>\n";
|
echo "<th>\n";
|
||||||
echo "<a class=\"userlist\" href=\"listusers.php?norefresh=1&sortattrib=" .
|
echo "<a class=\"userlist\" href=\"listusers.php?norefresh=1&sortattrib=" .
|
||||||
strtolower($attr_array[$k]) . $searchfilter . "\">" .
|
strtolower($attr_array[$k]) . $searchfilter . "&trans_primary=" . $trans_primary . "\">" .
|
||||||
$desc_array[$k] . "</a></th>\n";
|
$desc_array[$k] . "</a></th>\n";
|
||||||
}
|
}
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
@ -219,12 +240,19 @@ if ($user_count != 0) {
|
||||||
_("Edit") . "</a>\n</td>\n");
|
_("Edit") . "</a>\n</td>\n");
|
||||||
for ($k = 0; $k < sizeof($attr_array); $k++) {
|
for ($k = 0; $k < sizeof($attr_array); $k++) {
|
||||||
echo ("<td>\n");
|
echo ("<td>\n");
|
||||||
// print all attribute entries seperated by "; "
|
// print attribute values
|
||||||
if (sizeof($userinfo[$i][strtolower($attr_array[$k])]) > 0) {
|
if (sizeof($userinfo[$i][strtolower($attr_array[$k])]) > 0) {
|
||||||
// delete first array entry which is "count"
|
|
||||||
if (is_array($userinfo[$i][strtolower($attr_array[$k])])) {
|
if (is_array($userinfo[$i][strtolower($attr_array[$k])])) {
|
||||||
|
// delete first array entry which is "count"
|
||||||
array_shift($userinfo[$i][strtolower($attr_array[$k])]);
|
array_shift($userinfo[$i][strtolower($attr_array[$k])]);
|
||||||
echo utf8_decode(implode("; ", $userinfo[$i][strtolower($attr_array[$k])])) . "\n";
|
if (($trans_primary == "on") && (strtolower($attr_array[$k]) == "gidnumber")) {
|
||||||
|
// translate GID number to group name
|
||||||
|
if ($trans_primary_hash[$userinfo[$i][strtolower($attr_array[$k])][0]]) {
|
||||||
|
echo $trans_primary_hash[$userinfo[$i][strtolower($attr_array[$k])][0]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// print all attribute entries seperated by "; "
|
||||||
|
else echo utf8_decode(implode("; ", $userinfo[$i][strtolower($attr_array[$k])])) . "\n";
|
||||||
}
|
}
|
||||||
else echo utf8_decode($userinfo[$i][strtolower($attr_array[$k])]) . "\n";
|
else echo utf8_decode($userinfo[$i][strtolower($attr_array[$k])]) . "\n";
|
||||||
}
|
}
|
||||||
|
@ -246,12 +274,10 @@ if (! $_GET['norefresh']) {
|
||||||
$usr_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_UserSuffix());
|
$usr_units = $_SESSION['ldap']->search_units($_SESSION["config"]->get_UserSuffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
echo ("<p align=\"left\">\n");
|
|
||||||
echo ("<input type=\"submit\" name=\"new_user\" value=\"" . _("New User") . "\">\n");
|
|
||||||
if ($user_count != 0) echo ("<input type=\"submit\" name=\"del_user\" value=\"" . _("Delete User(s)") . "\">\n");
|
|
||||||
// print combobox with possible sub-DNs
|
// print combobox with possible sub-DNs
|
||||||
if (sizeof($usr_units) > 1) {
|
if (sizeof($usr_units) > 1) {
|
||||||
echo (" <b>" . _("Suffix") . ": </b>");
|
echo ("<p align=\"left\">\n");
|
||||||
|
echo ("<b>" . _("Suffix") . ": </b>");
|
||||||
echo ("<select size=1 name=\"usr_suffix\">\n");
|
echo ("<select size=1 name=\"usr_suffix\">\n");
|
||||||
for ($i = 0; $i < sizeof($usr_units); $i++) {
|
for ($i = 0; $i < sizeof($usr_units); $i++) {
|
||||||
if ($usr_suffix == $usr_units[$i]) echo ("<option selected>" . $usr_units[$i] . "</option>\n");
|
if ($usr_suffix == $usr_units[$i]) echo ("<option selected>" . $usr_units[$i] . "</option>\n");
|
||||||
|
@ -259,9 +285,30 @@ for ($i = 0; $i < sizeof($usr_units); $i++) {
|
||||||
}
|
}
|
||||||
echo ("</select>\n");
|
echo ("</select>\n");
|
||||||
echo ("<input type=\"submit\" name=\"refresh\" value=\"" . _("Change Suffix") . "\">");
|
echo ("<input type=\"submit\" name=\"refresh\" value=\"" . _("Change Suffix") . "\">");
|
||||||
|
echo ("</p>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// show translate GID to group name box if there is a column with gidnumber
|
||||||
|
if (in_array("gidnumber", $attr_array)) {
|
||||||
|
echo "<p align=\"left\">\n";
|
||||||
|
echo "<b>" . _("Translate GID number to group name") . ": </b>";
|
||||||
|
if ($trans_primary == "on") {
|
||||||
|
echo "<input type=\"checkbox\" name=\"trans_primary\" checked>";
|
||||||
|
}
|
||||||
|
else echo "<input type=\"checkbox\" name=\"trans_primary\">";
|
||||||
|
echo (" <input type=\"submit\" name=\"apply\" value=\"" . _("Apply") . "\">");
|
||||||
|
echo "</p>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo ("<p> </p>\n");
|
||||||
|
|
||||||
|
echo ("<p align=\"left\">\n");
|
||||||
|
echo ("<input type=\"submit\" name=\"new_user\" value=\"" . _("New User") . "\">\n");
|
||||||
|
if ($user_count != 0) echo ("<input type=\"submit\" name=\"del_user\" value=\"" . _("Delete User(s)") . "\">\n");
|
||||||
echo ("</p>\n");
|
echo ("</p>\n");
|
||||||
|
|
||||||
|
echo ("<p> </p>\n");
|
||||||
|
|
||||||
echo ("</form>\n");
|
echo ("</form>\n");
|
||||||
echo "</body></html>\n";
|
echo "</body></html>\n";
|
||||||
|
|
||||||
|
@ -276,19 +323,20 @@ function draw_navigation_bar ($user_count) {
|
||||||
global $page;
|
global $page;
|
||||||
global $sortattrib;
|
global $sortattrib;
|
||||||
global $searchfilter;
|
global $searchfilter;
|
||||||
|
global $trans_primary;
|
||||||
|
|
||||||
echo ("<table class=\"userlist-navbar\" width=\"100%\" border=\"0\"\n");
|
echo ("<table class=\"userlist-navbar\" width=\"100%\" border=\"0\"\n");
|
||||||
echo ("<tr>\n");
|
echo ("<tr>\n");
|
||||||
echo ("<td class=\"userlist-navbar\">\n<input type=\"submit\" name=\"refresh\" value=\"" . _("Refresh") . "\">\n ");
|
echo ("<td class=\"userlist-navbar\">\n<input type=\"submit\" name=\"refresh\" value=\"" . _("Refresh") . "\">\n ");
|
||||||
if ($page != 1)
|
if ($page != 1)
|
||||||
echo ("<a class=\"userlist\" href=\"listusers.php?norefresh=1&page=" .
|
echo ("<a class=\"userlist\" href=\"listusers.php?norefresh=1&page=" .
|
||||||
($page - 1) . "&sortattrib=" . $sortattrib . $searchfilter . "\"><=</a>\n");
|
($page - 1) . "&sortattrib=" . $sortattrib . $searchfilter . "&trans_primary=" . $trans_primary . "\"><=</a>\n");
|
||||||
else echo ("<=");
|
else echo ("<=");
|
||||||
echo (" ");
|
echo (" ");
|
||||||
|
|
||||||
if ($page < ($user_count / $max_pageentrys))
|
if ($page < ($user_count / $max_pageentrys))
|
||||||
echo ("<a class=\"userlist\" href=\"listusers.php?norefresh=1&page=" .
|
echo ("<a class=\"userlist\" href=\"listusers.php?norefresh=1&page=" .
|
||||||
($page + 1) . "&sortattrib=" . $sortattrib . $searchfilter . "\">=></a>\n");
|
($page + 1) . "&sortattrib=" . $sortattrib . $searchfilter . "&trans_primary=" . $trans_primary . "\">=></a>\n");
|
||||||
else echo ("=>");
|
else echo ("=>");
|
||||||
echo ("</td>\n");
|
echo ("</td>\n");
|
||||||
echo ("<td class=\"userlist-navbartext\">\n");
|
echo ("<td class=\"userlist-navbartext\">\n");
|
||||||
|
@ -300,7 +348,7 @@ function draw_navigation_bar ($user_count) {
|
||||||
for ($i = 0; $i < ($user_count / $max_pageentrys); $i++) {
|
for ($i = 0; $i < ($user_count / $max_pageentrys); $i++) {
|
||||||
if ($i == $page - 1) echo (" " . ($i + 1));
|
if ($i == $page - 1) echo (" " . ($i + 1));
|
||||||
else echo (" <a class=\"userlist\" href=\"listusers.php?norefresh=1&page=" .
|
else echo (" <a class=\"userlist\" href=\"listusers.php?norefresh=1&page=" .
|
||||||
($i + 1) . "&sortattrib=" . $sortattrib . $searchfilter .
|
($i + 1) . "&sortattrib=" . $sortattrib . $searchfilter . "&trans_primary=" . $trans_primary .
|
||||||
"\">" . ($i + 1) . "</a>\n");
|
"\">" . ($i + 1) . "</a>\n");
|
||||||
}
|
}
|
||||||
echo ("</td></tr>\n</table>\n");
|
echo ("</td></tr>\n</table>\n");
|
||||||
|
|
Loading…
Reference in New Issue