Changeset 3041 for trunk/workflow


Ignore:
Timestamp:
07/13/10 09:58:07 (14 years ago)
Author:
asaikawa
Message:

Ticket #871 - Implementada opcao para selecionar se exibe todas as contas, ou apenas as visiveis

Location:
trunk/workflow
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/workflow/inc/class.WorkflowLDAP.inc.php

    r2591 r3041  
    377377         * @access public 
    378378         */ 
    379         function getUsers($context) 
    380         { 
    381                 $filter = '(&(phpgwaccounttype=u)(!(phpgwAccountVisible=-1)))'; 
     379        function getUsers($context, $onlyVisibleAccounts = true) 
     380        { 
     381                $filter = '(phpgwaccounttype=u)'; 
     382                if($onlyVisibleAccounts) 
     383                        $filter = '(&' . $filter . '(!(phpgwAccountVisible=-1)))'; 
     384 
    382385                $elements = array('uidnumber', 'cn', 'mail'); 
    383386                return $this->getEntities($context, $filter, $elements, 'u', false); 
     
    561564         * @access public 
    562565         */ 
    563         function search($searchTerm, $includeUsers = true, $includeGroups = false, $includeLists = false, $context = null) 
     566        function search($searchTerm, $includeUsers = true, $includeGroups = false, $includeLists = false, $context = null, $onlyVisibleAccounts = true) 
    564567        { 
    565568                if (!($includeUsers || $includeGroups || $includeLists)) 
     
    586589                        $entityFilter = $entityFilter[0]; 
    587590 
    588                 $filter = "(&{$entityFilter}(cn={$searchTerm})(!(phpgwAccountVisible=-1)))"; 
     591                if($onlyVisibleAccounts) 
     592                        $filter = "(&{$entityFilter}(cn={$searchTerm})(!(phpgwAccountVisible=-1)))"; 
     593                else 
     594                        $filter = "(&{$entityFilter}(cn={$searchTerm}))"; 
     595 
    589596                $resourceIdentifier = ldap_search($this->dataSource, $context, $filter, array('cn', 'uidnumber', 'gidnumber', 'phpgwaccounttype', 'mail')); 
    590597                ldap_sort($this->dataSource, $resourceIdentifier, 'cn'); 
  • trunk/workflow/inc/class.bo_participants.inc.php

    r2591 r3041  
    7474                { 
    7575                        $preffix = ($usePreffix) ? 'u' : ''; 
    76                         $ents = $this->ldap->getUsers($params['context']); 
     76                        $ents = $this->ldap->getUsers($params['context'], $params['onlyVisibleAccounts']); 
    7777                        foreach ($ents as $ent) 
    7878                                $output[$preffix . $ent[$id]] = $ent['name']; 
     
    162162                $searchLists = (strpos($entities, 'l') !== false); 
    163163 
     164                $onlyVisibleAccounts = $params['onlyVisibleAccounts']; 
     165 
    164166                /* faz a busca */ 
    165167                $output = array(); 
    166                 $output['participants'] = $this->ldap->search($searchTerm, $searchUsers, $searchGroups, $searchLists); 
     168                $output['participants'] = $this->ldap->search($searchTerm, $searchUsers, $searchGroups, $searchLists, null, $onlyVisibleAccounts); 
    167169 
    168170                /* limita os resultados e define uma mensagem que será exibida */ 
  • trunk/workflow/inc/class.ui_participants.inc.php

    r2591 r3041  
    9292                $hideSectors = ($_REQUEST['hideSectors'] == '1') ? true : false; 
    9393 
     94                // the default value of $onlyVisibleAccounts is true 
     95                if((isset($_REQUEST['onlyVisibleAccounts'])) && (empty($_REQUEST['onlyVisibleAccounts']) || $_REQUEST['onlyVisibleAccounts'] === 'false')) 
     96                        $onlyVisibleAccounts = false; 
     97                else 
     98                        $onlyVisibleAccounts = true; 
     99 
    94100                /* define the initial organization */ 
    95101                $selectedOrganization = $ldap->getOrganizationFromDN($userDN); 
     
    117123                $smarty->assign('organizations', $organizationList); 
    118124                $smarty->assign('selectedOrganization', $selectedOrganization); 
    119                 $smarty->assign('sectors', $this->bo->getSectors(array('organization' => $selectedOrganization), true)); 
     125                $smarty->assign('sectors', $this->bo->getSectors(array('organization' => $selectedOrganization, 'onlyVisibleAccounts' => $onlyVisibleAccounts), true)); 
    120126                $smarty->assign('selectedSector', $selectedSector); 
    121                 $smarty->assign('participants', $this->bo->getEntities(array('entities' => $entities, 'id' => $id, 'context' => $selectedSector, 'usePreffix' => $usePreffix), true)); 
     127                $smarty->assign('participants', $this->bo->getEntities(array('entities' => $entities, 'id' => $id, 'context' => $selectedSector, 'onlyVisibleAccounts' => $onlyVisibleAccounts, 'usePreffix' => $usePreffix), true)); 
    122128                $smarty->assign('entities', $entities); 
    123129                $smarty->assign('id', $id); 
     
    126132                $smarty->assign('hideOrganizations', $hideOrganizations); 
    127133                $smarty->assign('hideSectors', $hideSectors); 
     134                $smarty->assign('onlyVisibleAccounts', $onlyVisibleAccounts); 
    128135                $smarty->assign('header', $smarty->expressoHeader); 
    129136                $smarty->assign('txt_loading', lang("loading")); 
  • trunk/workflow/inc/smarty/wf_plugins/function.wf_select_user.php

    r2591 r3041  
    1212 * - email_as_textarea : indica se o campo que receberá os emails deve ser um textarea (valor true) ou input type text (valor false). Este parâmetro só tem validade se get_email for true. 
    1313 * - hide_groups : indica se deve-se omitir os grupos na tela de seleção. 
     14 * - onlyVisibleAccounts : indica se devem ser recuperadas apenas as contas visíveis, ou se as ocultas também devem ser listadas. 
    1415 * - organization : nome da organização que estará previamente selecionada. 
    1516 * - title : texto da tooltip que aparecerá quando o usuário colocar o mouse sobre o ícone para adicionar usuário. 
     
    3536                'hide_organizations' => false, 
    3637                'hide_sectors' => false, 
     38                'onlyVisibleAccounts' => true, 
    3739                'rows'=> 2); 
    3840        $extractParams = array( 
     
    4244                'title', 
    4345                'cols', 
    44                 'rows'); 
     46                'rows', 
     47                'onlyVisibleAccounts'); 
    4548 
    4649        /* verifica se todos os parâmetros obrigatórios foram passados */ 
     
    9396        if ($params['hide_sectors'] == true) 
    9497                $extraParams .= "&hideSectors=1"; 
     98        if (empty($onlyVisibleAccounts) || $onlyVisibleAccounts === 'false') 
     99                $extraParams .= "&onlyVisibleAccounts=false"; 
     100        else 
     101                $extraParams .= "&onlyVisibleAccounts=true"; 
    95102 
    96103        $image = Factory::getInstance('TemplateServer')->generateImageLink('add_user.png'); 
    97104 
    98 $output .= <<<EOF 
    99         <a alt="$title" title="$title" href="javascript:void(0)" onclick="openParticipants('$name', '$extraParams');"><img border="0" alt="" src="$image" /></a> 
     105        $output .= <<<EOF 
     106                <a alt="$title" title="$title" href="javascript:void(0)" onclick="openParticipants('$name', '$extraParams');"><img border="0" alt="" src="$image" /></a> 
    100107EOF; 
    101108        return $output; 
  • trunk/workflow/inc/smarty/wf_plugins/function.wf_select_users.php

    r2591 r3041  
    88 * - value : usuários e grupos previamente selecionados. Deve estar no formato de matriz, seguindo o seguinte padrão: ::$matriz["u123"]="Nome do usuário 123" ; $matriz["g321"]="Nome do grupo 321" e, assim por diante. 
    99 * - hide_groups : indica se deve-se omitir os grupos na tela de seleção. 
     10 * - onlyVisibleAccounts : indica se devem ser recuperadas apenas as contas visíveis, ou se as ocultas também devem ser listadas. 
    1011 * - organization : nome da organização que estará previamente selecionada. 
    1112 * @param object &$smarty Instância do objeto smarty em uso 
     
    2425                'hide_organizations' => false, 
    2526                'hide_sectors' => false, 
     27                'onlyVisibleAccounts' => true, 
    2628                'value' => array()); 
    2729        $extractParams = array( 
    2830                'name', 
    29                 'value'); 
     31                'value', 
     32                'onlyVisibleAccounts'); 
    3033 
    3134        /* verifica se todos os parâmetros obrigatórios foram passados */ 
     
    5457        if ($params['hide_sectors'] == true) 
    5558                $extraParams .= "&hideSectors=1"; 
     59        if (empty($onlyVisibleAccounts) || $onlyVisibleAccounts === 'false') 
     60                $extraParams .= "&onlyVisibleAccounts=false"; 
     61        else 
     62                $extraParams .= "&onlyVisibleAccounts=true"; 
    5663 
    5764        $output = '<table border="0"><tr><td>'; 
     
    6673        $output .= "</td><td>"; 
    6774        $output .= <<<EOF 
    68                 <a href='javascript:void(0)' onclick="openParticipants(500, 270, '$name', '$extraParams');"><img border="0" src="$imagesPath/add_group.png"></a> 
     75                <a href='javascript:void(0)' onclick="openParticipants(500, 315, '$name', '$extraParams');"><img border="0" src="$imagesPath/add_group.png"></a> 
    6976                <br /> 
    70                 <a href='javascript:void(0)' onclick="openParticipants(500, 270, '$name', '$extraParams');">Adicionar</a> 
     77                <a href='javascript:void(0)' onclick="openParticipants(500, 315, '$name', '$extraParams');">Adicionar</a> 
    7178                <br /><br /> 
    7279                <a href='javascript:void(0)' onclick="delUsers('$name');"><img border="0" src="$imagesPath/delete_group.png"></a> 
  • trunk/workflow/js/jscode/participants.js

    r795 r3041  
    11var participantsClone = null; 
     2var chkOnlyVisibleAccountsClone = null; 
    23var searchTimer = null; 
    34var globalSearchEnter = true; 
     
    2324        var params = { 
    2425                organization: $F('organization'), 
     26                onlyVisibleAccounts: $F('onlyVisibleAccounts'), 
    2527                entities: $F('entities'), 
    2628                id: $F('id'), 
     
    3436        var params = { 
    3537                context: $F('sector'), 
     38                onlyVisibleAccounts: $F('onlyVisibleAccounts'), 
    3639                entities: $F('entities'), 
    3740                id: $F('id'), 
     
    4649        setSelectValue($('participants'), data); 
    4750        participantsClone = data; 
     51        if($('onlyVisibleAccounts')) 
     52                chkOnlyVisibleAccountsClone = $('onlyVisibleAccounts').checked; 
    4853} 
    4954 
     
    6368        var reg = new RegExp("<option[^>]*>[^<]*" + searchString + "[^<]*<\/option>", "gi"); 
    6469        setSelectValue($('participants'), participantsClone.match(reg)); 
     70        if($('onlyVisibleAccounts')) 
     71                $('onlyVisibleAccounts').checked = chkOnlyVisibleAccountsClone; 
    6572 
    6673        var participants = $('participants'); 
     
    126133 
    127134                obj = $('participants'); 
    128                 if (obj) 
     135                if (obj){ 
    129136                        participantsClone = obj.innerHTML; 
     137                        if($('onlyVisibleAccounts')) 
     138                                chkOnlyVisibleAccountsClone = $('onlyVisibleAccounts').checked; 
     139                } 
    130140 
    131141                obj = $('exitLink'); 
     
    140150                if (obj) 
    141151                        obj.focus(); 
     152 
     153                obj = $('onlyVisibleAccounts'); 
     154                if (obj) 
     155                        obj.onclick = checkOnlyVisibleAccounts; 
    142156 
    143157                obj = $('useGlobalSearch'); 
     
    149163        }); 
    150164}; 
     165 
     166function checkOnlyVisibleAccounts() 
     167{ 
     168        if(!$('useGlobalSearch').checked) 
     169                getParticipants(); 
     170        else 
     171                toggleFullSearch(); 
     172} 
    151173 
    152174function participantsFilterName(name) 
     
    330352        $('globalSearchWarnings').innerHTML = ''; 
    331353        var params = { 
     354                onlyVisibleAccounts: $F('onlyVisibleAccounts'), 
    332355                searchTerm: $F('search'), 
    333356                entities: $F('entities'), 
     
    341364{ 
    342365        newWidth   = 500; 
    343         newHeight  = 290; 
     366        newHeight  = 315; 
    344367        newScreenX = screen.width - newWidth; 
    345368        newScreenY = 0; 
  • trunk/workflow/templates/default/participants.tpl

    r795 r3041  
    3232                <td colspan="2"> 
    3333                        <p style="text-align: center; font-weight: bold; font-size: 130%;">Busca Global</p> 
     34                </td> 
     35        </tr> 
     36        <tr> 
     37                <td colspan="2"> 
     38                        <label><input type="checkbox" name="onlyVisibleAccounts" id="onlyVisibleAccounts" value="true" {if $onlyVisibleAccounts} checked {/if}/> Exibir apenas contas vis&iacute;veis</label> 
    3439                </td> 
    3540        </tr> 
Note: See TracChangeset for help on using the changeset viewer.