- Timestamp:
- 06/28/10 11:52:02 (14 years ago)
- Location:
- trunk/workflow
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/workflow/inc/class.bo_utils.inc.php
r2591 r2974 86 86 $ret_name = empty($params['name']) ? 'cn' : $params['name']; 87 87 88 $ret_complement = empty($params['complement']) ? '' : $params['complement']; 89 88 90 $ajaxConfig = &Factory::newInstance('ajax_config', 'contactcenter'); 89 91 $config = $ajaxConfig->read_repository(); … … 103 105 104 106 $filter = '(&(uid=*)(phpgwAccountType=u)(!(phpgwAccountVisible=-1))(cn=*' . $cn . '*))'; 105 $attrib_ret = array('cn', $ret_id, $ret_name); 107 108 if($ret_complement != '') 109 $attrib_ret = array('cn', $ret_id, $ret_name, $ret_complement); 110 else 111 $attrib_ret = array('cn', $ret_id, $ret_name); 106 112 107 113 $r = ldap_search($ds, $ldapconfig['basedn'], $filter, $attrib_ret, 0, 0, 5); … … 114 120 $result = ldap_get_entries($ds, $r); 115 121 foreach($result as $value){ 116 $output['values'][] = array( 122 if($value[$ret_name][0] != ""){ 123 if($params['complement'] != ''){ 124 $complement = " >> " . $value[$ret_complement][0]; 125 $output['values'][] = array( 126 'id' => $value[$ret_id], 127 'name' => trim(ucwords(strtolower($value[$ret_name][0]))) . $complement ); 128 } 129 else{ 130 $output['values'][] = array( 117 131 'id' => $value[$ret_id], 118 132 'name' => trim(ucwords(strtolower($value[$ret_name][0])))); 133 } 134 } 119 135 } 120 136 -
trunk/workflow/inc/smarty/plugins/function.html_options.php
r795 r2974 89 89 90 90 if(!empty($name)) { 91 $_html_result = '<select name="' . $name . '"' . $extra . '>' ."\n" . $_html_result . '</select>' . "\n";91 $_html_result = '<select name="' . $name . '"' . $extra . "\n" . $_html_result . '</select>' . "\n"; 92 92 } 93 93 … … 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)) { -
trunk/workflow/inc/smarty/wf_plugins/function.wf_select_ldap_users.php
r2591 r2974 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); … … 42 42 'class_btn', 43 43 'opt_id', 44 'opt_name'); 44 'opt_name', 45 'opt_complement'); 45 46 46 47 /* verifica se todos os parâmetros obrigatórios foram passados */ … … 78 79 $output = <<<EOF 79 80 <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)" />81 <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','$opt_complement', $handleExpiredSessions)" /> 81 82 <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>83 <span id="$name_span" style="display:none"> <b>Selecione um nome abaixo: </b><br><br> 83 84 EOF; 84 85 85 $output .= smarty_function_html_ options(array_merge(array(86 $output .= smarty_function_html_boxoptions(array_merge(array( 86 87 'name' => $name, 87 88 'id' => $name, -
trunk/workflow/js/jscode/wf_select_ldap_users.js
r795 r2974 9 9 * @param String opt_name Atributo que será atribuído ao name (innerHTML) das options da combo, por padrão é o 'cn' 10 10 */ 11 function search_ldap_users_by_cn(cn, target, opt_id, opt_name, handleExpiredSessions)11 function search_ldap_users_by_cn(cn, target, opt_id, opt_name, opt_complement, handleExpiredSessions) 12 12 { 13 13 /* Método que trata o retorno da chamada Ajax. Atribui os valores retornados à combobox */ … … 47 47 48 48 var url = '$this.bo_utils.search_ldap_users_by_cn'; 49 var param = "cn=" + cn + "&target=" + target + "&id=" + opt_id + "&name=" + opt_name ;49 var param = "cn=" + cn + "&target=" + target + "&id=" + opt_id + "&name=" + opt_name + "&complement=" + opt_complement; 50 50 51 51 document.getElementById(target + "_img").show();
Note: See TracChangeset
for help on using the changeset viewer.