Changeset 3061 for sandbox/workflow/branches/1015/inc/smarty
- Timestamp:
- 07/15/10 17:50:39 (14 years ago)
- Location:
- sandbox/workflow/branches/1015/inc/smarty
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/workflow/branches/1015/inc/smarty/plugins/function.html_options.php
r795 r3061 96 96 } 97 97 98 function 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 } 98 165 function smarty_function_html_options_optoutput($key, $value, $selected) { 99 166 if(!is_array($value)) { -
sandbox/workflow/branches/1015/inc/smarty/wf_plugins/function.wf_select_ldap_users.php
r2372 r3061 23 23 */ 24 24 function smarty_function_wf_select_ldap_users($params, &$smarty) 25 { 25 { 26 26 require_once $smarty->_get_plugin_filepath('function','html_options'); 27 27 $imagesPath = substr(Factory::getInstance('TemplateServer')->generateImageLink(''), 0, -1); … … 34 34 'size_input' => '20', 35 35 'opt_id' => 'dn', 36 'opt_name' => 'cn'); 36 'opt_name' => 'cn', 37 'opt_complement' => ''); 37 38 $extractParams = array( 38 39 'name', … … 42 43 'class_btn', 43 44 'opt_id', 44 'opt_name'); 45 'opt_name', 46 'opt_complement'); 45 47 46 48 /* verifica se todos os parâmetros obrigatórios foram passados */ … … 78 80 $output = <<<EOF 79 81 <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')" /> 81 83 <img id="$name_img" border="0" src="$imagesPath/loading.gif" style="display:none"> 82 <span id="$name_span" style="display:none"> <b>Selecione o nome: </b>84 <span id="$name_span" style="display:none"><br><br><b>Selecione um nome abaixo: </b><br><br> 83 85 EOF; 84 86 85 $output .= smarty_function_html_ options(array_merge(array(87 $output .= smarty_function_html_boxoptions(array_merge(array( 86 88 'name' => $name, 87 89 'id' => $name, -
sandbox/workflow/branches/1015/inc/smarty/wf_plugins/function.wf_select_user.php
r2372 r3061 12 12 * - 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. 13 13 * - 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. 14 15 * - organization : nome da organização que estará previamente selecionada. 15 16 * - title : texto da tooltip que aparecerá quando o usuário colocar o mouse sobre o ícone para adicionar usuário. … … 35 36 'hide_organizations' => false, 36 37 'hide_sectors' => false, 38 'onlyVisibleAccounts' => true, 37 39 'rows'=> 2); 38 40 $extractParams = array( … … 42 44 'title', 43 45 'cols', 44 'rows'); 46 'rows', 47 'onlyVisibleAccounts'); 45 48 46 49 /* verifica se todos os parâmetros obrigatórios foram passados */ … … 93 96 if ($params['hide_sectors'] == true) 94 97 $extraParams .= "&hideSectors=1"; 98 if (empty($onlyVisibleAccounts) || $onlyVisibleAccounts === 'false') 99 $extraParams .= "&onlyVisibleAccounts=false"; 100 else 101 $extraParams .= "&onlyVisibleAccounts=true"; 95 102 96 103 $image = Factory::getInstance('TemplateServer')->generateImageLink('add_user.png'); 97 104 98 $output .= <<<EOF99 <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> 100 107 EOF; 101 108 return $output; -
sandbox/workflow/branches/1015/inc/smarty/wf_plugins/function.wf_select_users.php
r2372 r3061 8 8 * - 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. 9 9 * - 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. 10 11 * - organization : nome da organização que estará previamente selecionada. 11 12 * @param object &$smarty Instância do objeto smarty em uso … … 24 25 'hide_organizations' => false, 25 26 'hide_sectors' => false, 27 'onlyVisibleAccounts' => true, 26 28 'value' => array()); 27 29 $extractParams = array( 28 30 'name', 29 'value'); 31 'value', 32 'onlyVisibleAccounts'); 30 33 31 34 /* verifica se todos os parâmetros obrigatórios foram passados */ … … 54 57 if ($params['hide_sectors'] == true) 55 58 $extraParams .= "&hideSectors=1"; 59 if (empty($onlyVisibleAccounts) || $onlyVisibleAccounts === 'false') 60 $extraParams .= "&onlyVisibleAccounts=false"; 61 else 62 $extraParams .= "&onlyVisibleAccounts=true"; 56 63 57 64 $output = '<table border="0"><tr><td>'; … … 66 73 $output .= "</td><td>"; 67 74 $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> 69 76 <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> 71 78 <br /><br /> 72 79 <a href='javascript:void(0)' onclick="delUsers('$name');"><img border="0" src="$imagesPath/delete_group.png"></a>
Note: See TracChangeset
for help on using the changeset viewer.