Ignore:
Timestamp:
08/17/10 16:17:12 (14 years ago)
Author:
viani
Message:

Ticket #1135 - Merged r1990:3166 from /trunk/workflow into /branches/2.2/workflow

Location:
branches/2.2/workflow/inc/smarty
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/workflow/inc/smarty/plugins/function.html_options.php

    r795 r3167  
    9696} 
    9797 
     98function smarty_function_html_boxoptions($params, &$smarty) 
     99{ 
     100    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); 
     101     
     102    $name = null; 
     103    $values = null; 
     104    $options = null; 
     105    $selected = array(); 
     106    $output = null; 
     107     
     108    $extra = ''; 
     109     
     110    foreach($params as $_key => $_val) { 
     111        switch($_key) { 
     112            case 'name': 
     113                $$_key = (string)$_val; 
     114                break; 
     115             
     116            case 'options': 
     117                $$_key = (array)$_val; 
     118                break; 
     119                 
     120            case 'values': 
     121            case 'output': 
     122                $$_key = array_values((array)$_val); 
     123                break; 
     124 
     125            case 'selected': 
     126                $$_key = array_map('strval', array_values((array)$_val)); 
     127                break; 
     128 
     129            default: 
     130                if(!is_array($_val)) { 
     131                    $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; 
     132                } else { 
     133                    $smarty->trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE); 
     134                } 
     135                break; 
     136        } 
     137    } 
     138 
     139    if (!isset($options) && !isset($values)) 
     140        return ''; /* raise error here? */ 
     141 
     142    $_html_result = ''; 
     143 
     144    if (isset($options)) { 
     145 
     146        foreach ($options as $_key=>$_val) 
     147            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected); 
     148 
     149    } else { 
     150 
     151        foreach ($values as $_i=>$_key) { 
     152            $_val = isset($output[$_i]) ? $output[$_i] : ''; 
     153            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected); 
     154        } 
     155 
     156    } 
     157 
     158    if(!empty($name)) { 
     159        $_html_result = '<select name="' . $name . '"' . $extra . ' style="height: 100px;" size="5">' . "\n" . $_html_result . '</select>' . "\n"; 
     160    } 
     161 
     162    return $_html_result; 
     163 
     164} 
    98165function smarty_function_html_options_optoutput($key, $value, $selected) { 
    99166    if(!is_array($value)) { 
  • branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_autocomplete_input.php

    r1935 r3167  
    2828        $defaultValues = array( 
    2929                'minLength'     => 1, 
    30                 'style'         => "width: 200px" 
     30                'style'         => "width: 200px", 
     31                'mode'          => "POPULATE_ON_LOAD" 
    3132        ); 
    3233        $extractParams = array( 
     
    3839                'idValue', 
    3940                'textValue', 
    40                 'style' 
     41                'style', 
     42                'mode' 
    4143        ); 
    4244 
     
    7981        $extraParams = json_encode($extraParams); 
    8082 
     83        /* se o componente for do tipo padrão (POPULATE_ON_LOAD), não necessita de função para onkeyup */ 
     84        if ($mode == 'POPULATE_ON_LOAD'){ 
     85                $inputElement = <<<EOF 
     86                <input id="$name_input" name="$name_input" type="text" value="$textValue" style="$style" onfocus="checkDataLoaded('$name');" onblur="setTimeout('selectAutocompleteElement(\'$name\')', 500);"/> 
     87EOF; 
     88        } 
     89        elseif ($mode == 'REPOPULATE_ON_CHANGE'){ 
     90                $inputElement = <<<EOF 
     91                <input id="$name_input" name="$name_input" type="text" value="$textValue" style="$style" onblur="setTimeout('selectAutocompleteElement(\'$name\')', 500);" onkeyup="updateCacheRequestsTimeout('$name', '$ajaxClass', '$ajaxMethod', this.value, '$mode')"/> 
     92EOF; 
     93        } 
     94 
     95        /* Cria todos os elementos HTML necessários para o componente */ 
    8196        $output = <<<EOF 
    8297        <input id="$name" name="$name" type="hidden"/> 
    83         <input id="$name_input" name="$name_input" type="text" value="$textValue" style="$style" onfocus="checkDataLoaded('$name');" onblur="setTimeout('selectAutocompleteElement(\'$name\')', 500);"/> 
     98        $inputElement 
    8499        <span id="$name_response"></span> 
    85100        <div id="$name_list" class="autocomplete" style="display: none;"></div> 
    86         <script>autocompleteSelect('$name', '$ajaxClass', '$ajaxMethod', $sep$methodParam$sep, $extraParams);</script> 
     101        <script>autocompleteSelect('$name', '$ajaxClass', '$ajaxMethod', $sep$methodParam$sep, '$mode', $extraParams);</script> 
    87102EOF; 
    88103        return $output; 
  • branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_generic_select.php

    r795 r3167  
    5353EOF; 
    5454 
    55         $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     55        $templateServer = &Factory::getInstance('TemplateServer'); 
    5656        $imageAdd = $templateServer->generateImageLink('add.png'); 
    5757        $imageRemove = $templateServer->generateImageLink('close.png'); 
  • branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_redir_menu.php

    r795 r3167  
    5353        $select_tag .= "<option value=\"og\">Organograma</option>"; 
    5454 
    55         $user_is_admin = $GLOBALS['workflow']['factory']->getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']); 
     55        $user_is_admin = Factory::getInstance('workflow_acl')->checkWorkflowAdmin($GLOBALS['phpgw_info']['user']['account_id']); 
    5656        if ($user_is_admin || ($GLOBALS['phpgw']->acl->check('admin_workflow',1,'workflow'))) { 
    5757                $select_tag .= "<option value=\"ad\">Administração</option>"; 
  • branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_select_city.php

    r795 r3167  
    3737                if (!array_key_exists($required, $params) || (empty($params[$required]))) 
    3838                        $smarty->trigger_error("[wf_select_city] missing required parameter(s): $required", E_USER_ERROR); 
    39          
     39 
    4040        /* atribui valores default para os parâmetros não passados */ 
    4141        foreach ($defaultValues as $key => $value) 
    4242                if (!isset($params[$key])) 
    4343                        $params[$key] = $value; 
    44          
     44 
    4545        /* extrai alguns parâmetros da matriz de parâmetros */ 
    4646        foreach ($extractParams as $extract) 
    4747                $$extract = $params[$extract]; 
    48          
     48 
    4949        /* parâmetros extras são "acumulados" em uma única variável */ 
    5050        $extraParams = array(); 
     
    5353                        $extraParams[$key] = $value_params; 
    5454 
    55         $db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID; 
     55        $db = &Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID; 
    5656        if (isset($params['value'])) 
    5757        { 
  • branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_select_ldap_users.php

    r795 r3167  
    2323 */ 
    2424function smarty_function_wf_select_ldap_users($params, &$smarty) 
    25 { 
     25{  
    2626    require_once $smarty->_get_plugin_filepath('function','html_options'); 
    27         $imagesPath = substr($GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink(''), 0, -1); 
     27        $imagesPath = substr(Factory::getInstance('TemplateServer')->generateImageLink(''), 0, -1); 
    2828 
    2929        $requiredParams = array( 
     
    3434                'size_input'            => '20', 
    3535                'opt_id'                => 'dn', 
    36                 'opt_name'              => 'cn'); 
     36                'opt_name'              => 'cn', 
     37                'opt_complement'        => ''); 
    3738        $extractParams = array( 
    3839                'name', 
     
    4243                'class_btn', 
    4344                'opt_id', 
    44                 'opt_name'); 
     45                'opt_name', 
     46                'opt_complement'); 
    4547 
    4648        /* verifica se todos os parâmetros obrigatórios foram passados */ 
     
    7880        $output = <<<EOF 
    7981                <input type="text" id="$name_input" name="$name_input" size="$size_input" /> 
    80                 <input type="button" class="$class_btn" value="$value_btn" onclick="search_ldap_users_by_cn(document.getElementById('$name_input').value, '$name', '$opt_id', '$opt_name', $handleExpiredSessions)" /> 
     82                <input type="button" class="$class_btn" value="$value_btn" onclick="search_ldap_users_by_cn(document.getElementById('$name_input').value, '$name', '$opt_id', '$opt_name', $handleExpiredSessions, '$opt_complement')" /> 
    8183                &nbsp;<img id="$name_img" border="0" src="$imagesPath/loading.gif" style="display:none"> 
    82                 <span id="$name_span" style="display:none">&nbsp;&nbsp;&nbsp;&nbsp;<b>Selecione o nome: </b> 
     84                <span id="$name_span" style="display:none"><br><br><b>Selecione um nome abaixo: </b><br><br> 
    8385EOF; 
    8486 
    85         $output .= smarty_function_html_options(array_merge(array( 
     87        $output .= smarty_function_html_boxoptions(array_merge(array( 
    8688                                                                                        'name'    => $name, 
    8789                                                                                        'id'      => $name, 
  • branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_select_state.php

    r795 r3167  
    4646        $sql = "SELECT id_state, state_name FROM phpgw_cc_state WHERE id_country = 'BR' ORDER BY state_name"; 
    4747 
    48         $result = $GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID->query($sql); 
     48        $result = Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID->query($sql); 
    4949        $estados = array(); 
    5050        while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) 
  • branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_select_user.php

    r795 r3167  
    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 
    96         $image = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink('add_user.png'); 
     103        $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; 
  • branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_select_users.php

    r795 r3167  
    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 
     
    1617{ 
    1718    require_once $smarty->_get_plugin_filepath('function','html_options'); 
    18         $imagesPath = substr($GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink(''), 0, -1); 
     19        $imagesPath = substr(Factory::getInstance('TemplateServer')->generateImageLink(''), 0, -1); 
    1920        $requiredParams = array( 
    2021                'name'); 
     
    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> 
  • branches/2.2/workflow/inc/smarty/wf_plugins/prefilter.wf_default_template.php

    r795 r3167  
    3131        { 
    3232                /* get the header and footer location */ 
    33                 $templateServer = &$GLOBALS['workflow']['factory']->getInstance('TemplateServer'); 
     33                $templateServer = &Factory::getInstance('TemplateServer'); 
    3434                $header = $templateServer->getSystemFile('processes/header.tpl'); 
    3535                $footer = $templateServer->getSystemFile('processes/footer.tpl'); 
Note: See TracChangeset for help on using the changeset viewer.