Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix Team and Group listing and filtering by keeping an alt. pregexp v…
Browse files Browse the repository at this point in the history
…alue.
  • Loading branch information
cdujeu committed Jul 4, 2016
1 parent 90766f3 commit 94a5e24
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
16 changes: 11 additions & 5 deletions core/src/plugins/core.conf/class.AbstractConfDriver.php
Expand Up @@ -1101,8 +1101,12 @@ public function switchAction($action, $httpVars, $fileVars)
$crtValue = $httpVars["value"];
$usersOnly = isSet($httpVars["users_only"]) && $httpVars["users_only"] == "true";
$existingOnly = isSet($httpVars["existing_only"]) && $httpVars["existing_only"] == "true";
if(!empty($crtValue)) $regexp = '^'.$crtValue;
else $regexp = null;
if(!empty($crtValue)) {
$regexp = '^'.$crtValue;
$pregexp = '/^'.preg_quote($crtValue).'/i';
} else {
$regexp = $pregexp = null;
}
$skipDisplayWithoutRegexp = ConfService::getCoreConf("USERS_LIST_REGEXP_MANDATORY", "conf");
if($skipDisplayWithoutRegexp && $regexp == null){
$users = "";
Expand Down Expand Up @@ -1193,13 +1197,13 @@ public function switchAction($action, $httpVars, $fileVars)
$users .= "<li class='complete_user_entry_temp' data-temporary='true' data-label='$crtValue' data-entry_id='$crtValue'><span class='user_entry_label'>$crtValue</span></li>";
}
$mess = ConfService::getMessages();
if ($regexp == null && !$usersOnly) {
if (!$usersOnly && (empty($regexp) || preg_match($pregexp, $mess["447"]))) {
$users .= "<li class='complete_group_entry' data-group='AJXP_GRP_/' data-label=\"".$mess["447"]."\"><span class='user_entry_label'>".$mess["447"]."</span></li>";
}
$indexGroup = 0;
if (!$usersOnly && isset($allGroups) && is_array($allGroups)) {
foreach ($allGroups as $groupId => $groupLabel) {
if ($regexp == null || preg_match("/$regexp/i", $groupLabel)) {
if ($regexp == null || preg_match($pregexp, $groupLabel)) {
$users .= "<li class='complete_group_entry' data-group='$groupId' data-label=\"$groupLabel\" data-entry_id='$groupId'><span class='user_entry_label'>".$groupLabel."</span></li>";
$indexGroup++;
}
Expand All @@ -1209,7 +1213,9 @@ public function switchAction($action, $httpVars, $fileVars)
if ($regexp == null && method_exists($this, "listUserTeams") && !$usersOnly) {
$teams = $this->listUserTeams();
foreach ($teams as $tId => $tData) {
$users.= "<li class='complete_group_entry' data-group='/AJXP_TEAM/$tId' data-label=\"[team] ".$tData["LABEL"]."\"><span class='user_entry_label'>[team] ".$tData["LABEL"]."</span></li>";
if($regexp == null || preg_match($pregexp, $tData["LABEL"])){
$users.= "<li class='complete_group_entry' data-group='/AJXP_TEAM/$tId' data-label=\"[team] ".$tData["LABEL"]."\"><span class='user_entry_label'>[team] ".$tData["LABEL"]."</span></li>";
}
}
}
foreach ($allUsers as $userId => $userObject) {
Expand Down
3 changes: 3 additions & 0 deletions core/src/plugins/core.conf/standard_conf_actions.xml
Expand Up @@ -473,6 +473,9 @@
window.ajxpBootstrap.parameters.set("currentLanguage", value);
}
]]></dialogOnComplete>
<dialogOnCancel><![CDATA[
pydio.Controller.fireAction("login");
]]></dialogOnCancel>
<dialogOnCancel><![CDATA[]]></dialogOnCancel>
</clientCallback>
<clientForm id="switch_language_form"><![CDATA[
Expand Down

0 comments on commit 94a5e24

Please sign in to comment.