Changeset 3167 for branches/2.2/workflow/inc/smarty
- Timestamp:
- 08/17/10 16:17:12 (14 years ago)
- 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 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)) { -
branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_autocomplete_input.php
r1935 r3167 28 28 $defaultValues = array( 29 29 'minLength' => 1, 30 'style' => "width: 200px" 30 'style' => "width: 200px", 31 'mode' => "POPULATE_ON_LOAD" 31 32 ); 32 33 $extractParams = array( … … 38 39 'idValue', 39 40 'textValue', 40 'style' 41 'style', 42 'mode' 41 43 ); 42 44 … … 79 81 $extraParams = json_encode($extraParams); 80 82 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);"/> 87 EOF; 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')"/> 92 EOF; 93 } 94 95 /* Cria todos os elementos HTML necessários para o componente */ 81 96 $output = <<<EOF 82 97 <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 84 99 <span id="$name_response"></span> 85 100 <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> 87 102 EOF; 88 103 return $output; -
branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_generic_select.php
r795 r3167 53 53 EOF; 54 54 55 $templateServer = & $GLOBALS['workflow']['factory']->getInstance('TemplateServer');55 $templateServer = &Factory::getInstance('TemplateServer'); 56 56 $imageAdd = $templateServer->generateImageLink('add.png'); 57 57 $imageRemove = $templateServer->generateImageLink('close.png'); -
branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_redir_menu.php
r795 r3167 53 53 $select_tag .= "<option value=\"og\">Organograma</option>"; 54 54 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']); 56 56 if ($user_is_admin || ($GLOBALS['phpgw']->acl->check('admin_workflow',1,'workflow'))) { 57 57 $select_tag .= "<option value=\"ad\">Administração</option>"; -
branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_select_city.php
r795 r3167 37 37 if (!array_key_exists($required, $params) || (empty($params[$required]))) 38 38 $smarty->trigger_error("[wf_select_city] missing required parameter(s): $required", E_USER_ERROR); 39 39 40 40 /* atribui valores default para os parâmetros não passados */ 41 41 foreach ($defaultValues as $key => $value) 42 42 if (!isset($params[$key])) 43 43 $params[$key] = $value; 44 44 45 45 /* extrai alguns parâmetros da matriz de parâmetros */ 46 46 foreach ($extractParams as $extract) 47 47 $$extract = $params[$extract]; 48 48 49 49 /* parâmetros extras são "acumulados" em uma única variável */ 50 50 $extraParams = array(); … … 53 53 $extraParams[$key] = $value_params; 54 54 55 $db = & $GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID;55 $db = &Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID; 56 56 if (isset($params['value'])) 57 57 { -
branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_select_ldap_users.php
r795 r3167 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 $imagesPath = substr( $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink(''), 0, -1);27 $imagesPath = substr(Factory::getInstance('TemplateServer')->generateImageLink(''), 0, -1); 28 28 29 29 $requiredParams = array( … … 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, -
branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_select_state.php
r795 r3167 46 46 $sql = "SELECT id_state, state_name FROM phpgw_cc_state WHERE id_country = 'BR' ORDER BY state_name"; 47 47 48 $result = $GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID->query($sql);48 $result = Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID->query($sql); 49 49 $estados = array(); 50 50 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) -
branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_select_user.php
r795 r3167 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 $image = $GLOBALS['workflow']['factory']->getInstance('TemplateServer')->generateImageLink('add_user.png');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; -
branches/2.2/workflow/inc/smarty/wf_plugins/function.wf_select_users.php
r795 r3167 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 … … 16 17 { 17 18 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); 19 20 $requiredParams = array( 20 21 'name'); … … 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> -
branches/2.2/workflow/inc/smarty/wf_plugins/prefilter.wf_default_template.php
r795 r3167 31 31 { 32 32 /* get the header and footer location */ 33 $templateServer = & $GLOBALS['workflow']['factory']->getInstance('TemplateServer');33 $templateServer = &Factory::getInstance('TemplateServer'); 34 34 $header = $templateServer->getSystemFile('processes/header.tpl'); 35 35 $footer = $templateServer->getSystemFile('processes/footer.tpl');
Note: See TracChangeset
for help on using the changeset viewer.