Changeset 4644 for sandbox/expressoMail1_2/MailArchiver
- Timestamp:
- 06/30/11 19:00:36 (13 years ago)
- Location:
- sandbox/expressoMail1_2/MailArchiver/2.2
- Files:
-
- 4 deleted
- 74 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
sandbox/expressoMail1_2/MailArchiver/2.2/doc-expressolivre/debian/arqs-conf/etc/ldap/slapd.conf.lenny
r3850 r4644 90 90 91 91 # Indexing options for database #1 92 index mailAlternateAddress,objectClass,memberUid,uidNumber,deliveryMode,accountStatus,phpgwAccountType,gidNumber,phpgwAccountStatus,ou pres,eq 93 index mail,uid,cn,sn,givenName pres,eq,sub 92 index mailForwardingAddress,objectClass,memberUid,uidNumber,deliveryMode,accountStatus,phpgwAccountType,gidNumber,phpgwAccountStatus,ou,cpf,accountRestrictive pres,eq 93 index mailAlternateAddress sub,pres,eq 94 index mail sub,pres,eq 95 index uid,cn,sn,givenName pres,eq,sub 94 96 95 97 # Save the time that the entry gets modified, for database #1 -
sandbox/expressoMail1_2/MailArchiver/2.2/doc-expressolivre/debian/arqs-conf/etc/php5/apache2/php.ini
r3337 r4644 1034 1034 ; 2: Overload str*() functions 1035 1035 ; 4: Overload ereg*() functions 1036 mbstring.func_overload = 71036 mbstring.func_overload = 0 1037 1037 1038 1038 [FrontBase] -
sandbox/expressoMail1_2/MailArchiver/2.2/doc-expressolivre/debian/expressoInstallDebian-squeeze.sh
r3983 r4644 71 71 cp ./arqs-conf/etc/php5/apache2/php.ini /etc/php5/apache2/ 72 72 mkdir /php_sessions/ || { echo "Diretorio ja existe. [OK]"; } 73 chmod -R 77 7/php_sessions/73 chmod -R 770 /php_sessions/ 74 74 75 75 a2ensite expresso -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoAdmin1_2/inc/class.ldap_functions.inc.php
r3530 r4644 974 974 function add_user2maillist($uid, $mail) 975 975 { 976 if ( !$ldapMasterConnect = $this->ldapMasterConnect() )977 {978 $result['status'] = false;979 $result['msg'] = $this->functions->lang('Ldap connection fail') . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect);980 return $result;981 }982 983 976 $filter = "(&(phpgwAccountType=l)(uid=$uid))"; 984 977 $justthese = array("dn"); 985 $search = ldap_search($ ldapMasterConnect, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese);986 $entry = ldap_get_entries($ ldapMasterConnect, $search);978 $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 979 $entry = ldap_get_entries($this->ldap, $search); 987 980 $group_dn = $entry[0]['dn']; 988 981 $attrs['mailForwardingAddress'] = $mail; 989 $res = @ldap_mod_add($ ldapMasterConnect, $group_dn, $attrs);982 $res = @ldap_mod_add($this->ldap, $group_dn, $attrs); 990 983 991 984 if ($res) … … 996 989 { 997 990 $result['status'] = false; 998 if (ldap_errno($ ldapMasterConnect) == '50')991 if (ldap_errno($this->ldap) == '50') 999 992 { 1000 993 $result['msg'] = $this->functions->lang('Error on the function') . ' ldap_functions->add_user2maillist' . ".\n" . 1001 $this->functions->lang('The user used for record on L PDA, must have write access') . ".\n";994 $this->functions->lang('The user used for record on LDAP, must have write access') . ".\n"; 1002 995 $this->functions->lang('The user') . ' ' . $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] . ' ' . $this->functions->lang('does not have this access') . ".\n"; 1003 996 $this->functions->lang('Edit Global Catalog Config, in the admin module, and add an user with write access') . ".\n"; 1004 997 } 1005 998 else 1006 $result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->add_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ ldapMasterConnect);1007 } 1008 1009 ldap_close($ ldapMasterConnect);999 $result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->add_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap); 1000 } 1001 1002 ldap_close($this->ldap); 1010 1003 return $result; 1011 1004 } … … 1031 1024 function remove_user2maillist($uid, $mail) 1032 1025 { 1033 if ( !$ldapMasterConnect = $this->ldapMasterConnect() )1034 {1035 $result['status'] = false;1036 $result['msg'] = $this->functions->lang('Ldap connection fail') . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ldapMasterConnect);1037 return $result;1038 }1039 1040 1026 $filter = "(&(phpgwAccountType=l)(uid=$uid))"; 1041 1027 $justthese = array("dn"); 1042 $search = ldap_search($ ldapMasterConnect, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese);1043 $entry = ldap_get_entries($ ldapMasterConnect, $search);1028 $search = ldap_search($this->ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 1029 $entry = ldap_get_entries($this->ldap, $search); 1044 1030 $group_dn = $entry[0]['dn']; 1045 1031 $attrs['mailForwardingAddress'] = $mail; 1046 $res = @ldap_mod_del($ ldapMasterConnect, $group_dn, $attrs);1032 $res = @ldap_mod_del($this->ldap, $group_dn, $attrs); 1047 1033 1048 1034 if ($res) … … 1053 1039 { 1054 1040 $result['status'] = false; 1055 if (ldap_errno($ ldapMasterConnect) == '50')1041 if (ldap_errno($this->ldap) == '50') 1056 1042 { 1057 1043 $result['msg'] = $this->functions->lang('Error on the function') . ' ldap_functions->remove_user2maillist' . ".\n" . 1058 $this->functions->lang('The user used for record on L PDA, must have write access') . ".\n";1044 $this->functions->lang('The user used for record on LDAP, must have write access') . ".\n"; 1059 1045 $this->functions->lang('The user') . ' ' . $_SESSION['phpgw_info']['expresso']['cc_ldap_server']['acc'] . ' ' . $this->functions->lang('does not have this access') . ".\n"; 1060 1046 $this->functions->lang('Edit Global Catalog Config, in the admin module, and add an user with write access') . ".\n"; 1061 1047 } 1062 1048 else 1063 $result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->remove_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($ ldapMasterConnect);1064 } 1065 ldap_close($ ldapMasterConnect);1049 $result['msg'] = $this->functions->lang('Error on function') . " ldap_functions->remove_user2maillist ($dn)" . ".\n" . $this->functions->lang('Server returns') . ': ' . ldap_error($this->ldap); 1050 } 1051 ldap_close($this->ldap); 1066 1052 return $result; 1067 1053 } -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoAdmin1_2/inc/class.totalsessions.inc.php
r414 r4644 75 75 76 76 $fd = fopen ($path . '/' . $file,'r'); 77 $session = @fread ($fd, filesize ($path . '/' . $file));77 $session = @fread ($fd, 50); 78 78 fclose ($fd); 79 79 80 if (s ubstr($session,0,14) != 'phpgw_session|')80 if (strstr($session,'phpgw_session|') === FALSE) 81 81 { 82 82 continue; -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoAdmin1_2/setup/setup.inc.php
r4250 r4644 13 13 $setup_info['expressoAdmin1_2']['title'] = 'Expresso Admin'; 14 14 /* Ao incrementar versão, não esquecer de declarar função do tables_update.inc.php*/ 15 $setup_info['expressoAdmin1_2']['version'] = '2.2. 2';15 $setup_info['expressoAdmin1_2']['version'] = '2.2.3'; 16 16 $setup_info['expressoAdmin1_2']['app_order'] = 1; 17 17 $setup_info['expressoAdmin1_2']['tables'][] = 'phpgw_expressoadmin'; -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoAdmin1_2/setup/tables_update.inc.php
r4250 r4644 73 73 return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver']; 74 74 } 75 $test[] = '2.2.2'; 76 function expressoAdmin1_2_upgrade2_2_2() 77 { 78 $GLOBALS['setup_info']['expressoAdmin1_2']['currentver'] = '2.2.3'; 79 return $GLOBALS['setup_info']['expressoAdmin1_2']['currentver']; 80 } 75 81 ?> -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoAdmin1_2/templates/default/managers.tpl
r309 r4644 5 5 <td align="right"> 6 6 <form method="POST" action="{action}"> 7 <input type="submit" value="{lang_add_manager}" 7 <input type="submit" value="{lang_add_manager}"> 8 8 </form> 9 9 </td> -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/inc
-
Property
svn:ignore
set to
.class.ScriptS.inc.php.swp
.class.SieveS.inc.php.swp
-
Property
svn:ignore
set to
-
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/inc/class.ScriptS.inc.php
r3859 r4644 6 6 class ScriptS { 7 7 8 //Declaração de Variáveis; 9 var $SieveS; // Var para criação do objeto; 10 var $reply; // Var para resposta; 11 var $scriptfile; // Nome do script; 12 var $username; // Nome do usuario; 13 var $rules; // Regras do sieve; 14 var $errstr; // Erros retornados; 15 var $size; // Tamanho; 16 var $so; // Verifica se a regra foi criada por outro tipo serviço de filtros; 17 var $continuebit; 18 var $sizebit; 19 var $anyofbit; 20 var $keepbit; 21 var $regexbit; 22 var $newrules = array(); 23 var $newout; 24 var $teste; 25 var $EmailVoip; 26 var $EmailExpresso; 27 28 function ScriptS() { 29 30 //Cria o objeto; 31 $this->SieveS = new SieveS(); 32 33 //$this->scriptfile = $GLOBALS['HTTP_SESSION_VARS']['phpgw_info']['expressomail']['user']['account_lid']; 34 $this->scriptfile = $_SESSION['phpgw_info']['expressomail']['user']['account_lid']; 35 $this->username = $this->scriptfile; 36 37 $this->reply = ""; 38 $this->rules = ""; 39 $this->errstr = ""; 40 $this->size = ""; 41 42 $this->continuebit = 1; 43 $this->sizebit = 1; 44 $this->anyofbit = 4; 45 $this->keepbit = 8; 46 $this->regexbit = 128; 47 48 $this->EmailVoip = trim($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['voip_email_redirect']); 49 $this->EmailExpresso = trim($_SESSION['phpgw_info']['expressomail']['user']['email']); 50 } 51 52 function init_a() { 53 54 //Abre a conexão 55 $this->SieveS->start(); 56 57 $this->reply = $this->SieveS->getscript(); 58 59 if (!$this->reply) { 60 61 $aux = $this->SieveS->putscript($this->scriptfile, $this->createScript()); 62 if (!$aux) { 63 // Caso de erro, grava dentro da variável errstr; 64 $this->errstr = "Error: file not created"; 65 return $this->errstr; 66 } 67 // Mata a variavel; 68 unset($aux); 69 // Ativa o script; 70 $aux = $this->SieveS->activatescript($this->scriptfile); 71 72 if (!$aux) { 73 // Caso de erro, grava dentro da variavel errstr; 74 $this->errstr = "Error: error to activate file"; 75 return $this->errstr; 76 } else { 77 $this->reply = $this->SieveS->getscript(); 78 $this->rules = $this->readScript($this->reply); 79 } 80 } else { 81 $this->rules = $this->readScript($this->reply); 82 } 83 84 //Fecha a conexao 85 $this->SieveS->close(); 86 87 if ($this->rules) 88 return $this->rules; 89 } 90 91 function rec_rules($params) { 92 93 $newr1 = array(); 94 $newr2 = array(); 95 $newr3 = array(); 96 97 $var_decode = rawurldecode($params['arfilter']); 98 $var_decode = preg_replace('/\n\./', '.', $var_decode); 99 100 $narray = explode("_end_", $var_decode); 101 102 foreach ($narray as $key => $tmp) { 103 if ($tmp != "") { 104 $newr1[] = $tmp; 105 } 106 } 107 unset($key); 108 unset($tmp); 109 foreach ($newr1 as $key => $tmp) { 110 $tmp2 = explode("_begin_##", $tmp); 111 foreach ($tmp2 as $tmp3) { 112 if ($tmp3 != "") { 113 $newr2[] = trim($tmp3); 114 } 115 } 116 } 117 118 unset($tmp); 119 unset($tmp2); 120 unset($tmp3); 121 122 foreach ($newr2 as $tmp) { 123 if (trim($tmp) != "") { 124 $tmp2 = explode("##", $tmp); 125 foreach ($tmp2 as $tmp3) { 126 $tmp4 .= trim($tmp3) . "&&"; 127 } 128 $newr3[] = substr($tmp4, 0, (strlen($tmp4) - 4)); 129 unset($tmp2); 130 unset($tmp3); 131 unset($tmp4); 132 } 133 } 134 135 $tmp = $newr3[count($newr3) - 1]; 136 137 if (substr($tmp, 0, 9) == "#vacation") { 138 $this->newout = array_pop($newr3); 139 foreach ($newr3 as $key => $tmp) { 140 $this->newrules[] = $tmp; 141 } 142 } else { 143 foreach ($newr3 as $tmp) { 144 $this->newrules[] = $tmp; 145 } 146 } 147 148 unset($tmp); 149 $tmp = explode("&&", $this->newout); 150 $tmp1 = explode(",", $tmp[2]); 151 foreach ($tmp1 as $key => $tmp2) { 152 $tmp3 .= stripslashes(trim($tmp2)) . ", "; 153 } 154 $tmp3 = substr($tmp3, 0, (strlen($tmp3) - 2)); 155 156 unset($tmp); 157 unset($tmp1); 158 unset($tmp2); 159 unset($key); 160 $tmp = explode("&&", $this->newout); 161 foreach ($tmp as $key => $tmp1) { 162 if ($key == 2) { 163 $tmp2 .= trim($tmp3) . "&&"; 164 } else { 165 $tmp2 .= trim($tmp1) . "&&"; 166 } 167 } 168 unset($this->newout); 169 $this->newout = substr($tmp2, 0, (strlen($tmp2) - 2)); 170 171 //Abre a conexao 172 $this->SieveS->start(); 173 $this->errstr = ""; 174 175 // Escreve a nova regra; 176 $this->reply = $this->SieveS->getscript(); 177 /* 178 if($this->reply){ 179 $this->errstr = $this->SieveS->deletescript($this->scriptfile); 180 } 181 */ 182 183 $error_log_file = "/home/expressolivre/sieve_error.log"; 184 //Escreve a(s) nova(s) regra(s); 185 $newrule = $this->write_rule(); 186 if (strlen($newrule) > 0) 187 $this->errstr = $this->SieveS->putscript($this->scriptfile, $newrule); 188 else { 189 if ($_SESSION['phpgw_info']['server']['expressomail']['expressoMail_enable_log_messages'] == "True") 190 error_log(date("D M j G:i:s T Y") . ": SieveError, Invalid rule for " 191 . $_SESSION['phpgw_info']['expressomail']['user']['userid'] . "=>" 192 . $this->teste . "\nRule:" 193 . $var_decode . "\n", 3, $error_log_file); 194 return "Invalid rule\n" . $this->teste; 195 } 196 197 //Ativa o script; 198 $this->errstr = $this->SieveS->activatescript($this->scriptfile); 199 200 //Fecha a conexao 201 $this->SieveS->close(); 202 203 if ($this->errstr) { 204 return "Ok"; 205 } else { 206 if ($_SESSION['phpgw_info']['server']['expressomail']['expressoMail_enable_log_messages'] == "True") 207 error_log(date("D M j G:i:s T Y") 208 . ": SieveError, Problem for " 209 . $_SESSION['phpgw_info']['expressomail']['user']['userid'] . "=>" 210 . " " 211 . $this->SieveS->errstr . "\n", 3, $error_log_file); 212 return "Problemas na criação do arquivo!\n" . $this->teste; 213 } 214 } 215 216 function convert_specialchar($input) { 217 $special_char = false; 218 for ($i = 0; $i < strlen($input); $i++) { 219 if (preg_match('/[^a-z0-9.@~_+=&\'*^\ \-\[\]]/i', $input[$i])) { 220 $special_char = true; 221 $input = preg_replace('/\\' . $input[$i] . '/', '=' . bin2hex($input[$i]), $input); 222 } 223 } 224 225 if ($special_char) { 226 /* * 227 * When using arrays with pattern and replacement, 228 * the keys are processed in the order they appear in the array. 229 * See preg_replace in php.net/preg_replace 230 * */ 231 $patterns[0] = '/=c3/i'; 232 $patterns[1] = '/ /'; 233 $replacements[1] = ''; 234 $replacements[0] = '_'; 235 $input = preg_replace($patterns, $replacements, $input); 236 } 237 238 return($input); 239 } 240 241 // build the rule 242 function write_rule() { 243 244 // Variaveis; 245 $rule = array(); 246 $vacation = array(); 247 $newruletext = ""; 248 $activerules = 0; 249 $regexused = 0; 250 $rejectused = 0; 251 $notify = 0; 252 $flaggedused = 0; 253 $newscriptbody = ""; 254 $continue = 1; 255 $tmpSubject = ""; 256 257 // Recebe os valores das regras; 258 foreach ($this->newrules as $tmp) { 259 $tmp1 = explode("&&", $tmp); 260 $rule['priority'] = $tmp1[1]; 261 $rule['status'] = $tmp1[2]; 262 $rule['from'] = $this->convert_specialchar($tmp1[3]); 263 $rule['to'] = $this->convert_specialchar($tmp1[4]); 264 $tmpSubject = $tmp1[5]; 265 $rule['subject'] = $this->convert_specialchar($tmp1[5]); 266 $rule['action'] = $tmp1[6]; 267 $rule['action_arg'] = utf8_encode(preg_replace("/\\r\\n/", "\r\n", $tmp1[7])); 268 $rule['flg'] = $tmp1[8]; 269 $rule['field'] = $tmp1[9]; 270 $rule['field_val'] = $tmp1[10]; 271 $rule['size'] = $tmp1[11]; 272 $rule['continue'] = ($tmp1[8] & $this->continuebit); 273 $rule['gthan'] = ($tmp1[8] & $this->sizebit); 274 $rule['anyof'] = ($tmp1[8] & $this->anyofbit); 275 $rule['keep'] = ($tmp1[8] & $this->keepbit); 276 $rule['regexp'] = ($tmp1[8] & $this->regexbit); 277 $rule['unconditional'] = 0; 278 279 if (!$rule['from'] && !$rule['to'] && !$rule['subject'] && !$rule['field'] && empty($rule['size']) && $rule['action']) { 280 $rule['unconditional'] = 1; 281 282 if ($rule['unconditional'] && ($rule['size'] == "0" || $rule['size'] == 0 )) 283 $rule['unconditional'] = 0; 284 } 285 unset($tmp1); 286 287 // Monta as regras; 288 if ($rule['status'] != 'ENABLED') { 289 290 } else { 291 $activerules = 1; 292 293 // Condições para montagem das regras; 294 $anyall = "allof"; 295 if ($rule['anyof']) 296 $anyall = "anyof"; 297 if ($rule['regexp']) { 298 $regexused = 1; 299 } 300 $started = 0; 301 302 if (!$rule['unconditional']) { 303 if (!$continue) 304 $newruletext .= "els"; 305 $newruletext .= "if " . $anyall . " ("; 306 if ($rule['from']) { 307 if (preg_match("/^\s*!/", $rule['from'])) { 308 $newruletext .= 'not '; 309 $rule['from'] = preg_replace("/^\s*!/", "", $rule['from']); 310 } 311 $match = ':contains'; 312 if (preg_match("/\*|\?/", $rule['from'])) 313 $match = ':matches'; 314 if ($rule['regexp']) 315 $match = ':regex'; 316 $newruletext .= "header " . $match . " [\"From\"]"; 317 $newruletext .= " \"" . $rule['from'] . "\""; 318 $started = 1; 319 } 320 if ($rule['to']) { 321 if ($started) 322 $newruletext .= ", "; 323 if (preg_match("/^\s*!/", $rule['to'])) { 324 $newruletext .= 'not '; 325 $rule['to'] = preg_replace("/^\s*!/", "", $rule['to']); 326 } 327 $match = ':contains'; 328 if (preg_match("/\*|\?/", $rule['to'])) 329 $match = ':matches'; 330 if ($rule['regexp']) 331 $match = ':regex'; 332 $newruletext .= "address " . $match . " [\"To\",\"TO\",\"Cc\",\"CC\"]"; 333 $newruletext .= " \"" . $rule['to'] . "\""; 334 $started = 1; 335 } 336 if ($rule['subject']) { 337 if ($started) 338 $newruletext .= ", "; 339 if (preg_match("/^\s*!/", $rule['subject'])) { 340 $newruletext .= 'not '; 341 $rule['subject'] = preg_replace("/^\s*!/", "", $rule['subject']); 342 } 343 $match = ':contains'; 344 if (preg_match("/\*|\?/", $rule['subject'])) 345 $match = ':matches'; 346 if ($rule['regexp']) 347 $match = ':regex'; 348 $newruletext .= "header " . $match . " \"subject\""; 349 $newruletext .= " \"" . $rule['subject'] . "\""; 350 $started = 1; 351 } 352 if ($rule['field'] && $rule['field_val']) { 353 if ($started) 354 $newruletext .= ", "; 355 if (preg_match("/^\s*!/", $rule['field_val'])) { 356 $newruletext .= 'not '; 357 $rule['field_val'] = preg_replace("/^\s*!/", "", $rule['field_val']); 358 } 359 $match = ':contains'; 360 if (preg_match("/\*|\?/", $rule['field_val'])) 361 $match = ':matches'; 362 if ($rule['regexp']) 363 $match = ':regex'; 364 $newruletext .= "header " . $match . " \"" . $rule['field'] . "\""; 365 $newruletext .= " \"" . $rule['field_val'] . "\""; 366 $started = 1; 367 } 368 369 if ($rule['size'] != '') 370 { 371 if ($rule['size'] == 0) { 372 $xthan = " :under "; 373 if ($rule['gthan']) 374 $xthan = " :over "; 375 if ($started) 376 $newruletext .= ", "; 377 378 $newruletext .= "size " . $xthan . "0K"; 379 $started = 1; 380 } 381 382 if ($rule['size'] > 0) { 383 $xthan = " :under "; 384 if ($rule['gthan']) 385 $xthan = " :over "; 386 if ($started) 387 $newruletext .= ", "; 388 389 $newruletext .= "size " . $xthan . $rule['size'] . "K"; 390 $started = 1; 391 } 392 } 393 } 394 395 // Don't write half rule! 396 if (strlen($newruletext) == 0) 397 return false; 398 // Actions 399 if (!$rule['unconditional']) 400 $newruletext .= ") {\n\t"; 401 402 if (preg_match("/folder/i", $rule['action'])) { 403 $newruletext .= "fileinto \"" . $rule['action_arg'] . "\";"; 404 } 405 406 if (preg_match("/reject/i", $rule['action'])) { 407 $newruletext .= "reject text: \n" . $rule['action_arg'] . "\n.\n;"; 408 $rejectused = 1; 409 } 410 if (preg_match("/flagged/i", $rule['action'])) { 411 $newruletext .= "addflag \"\\\\Flagged\";"; 412 $flaggedused = 1; 413 } 414 if (preg_match("/address/i", $rule['action'])) { 415 $newruletext .= "redirect \"" . $rule['action_arg'] . "\";"; 416 } 417 418 if (preg_match("/notify/i", $rule['action'])) { 419 $newruletext .= "notify :method \"mailto\" :options [\"" . $this->EmailVoip . "\"]:" . 420 "message \"<expressovoip><from>" . $this->EmailExpresso . "</from>" . 421 "<br/><Subject>" . utf8_encode($tmpSubject) . "</Subject></expressovoip>\";"; 422 $notify = 1; 423 } 424 425 if (preg_match("/discard/i", $rule['action'])) { 426 $newruletext .= "discard;"; 427 } 428 if ($rule['keep']) 429 $newruletext .= "\n\tfileinto \"INBOX\";"; 430 //if ($rule['keep']) $newruletext .= "\n\tkeep;"; 431 if (!$rule['unconditional']) 432 $newruletext .= "\n}"; 433 434 $continue = 0; 435 if ($rule['continue']) 436 $continue = 1; 437 if ($rule['unconditional']) 438 $continue = 1; 439 440 $newscriptbody .= $newruletext . "\n\n"; 441 unset($newruletext); 442 } 443 }// Fim do Foreach; 444 $this->teste = $newscriptbody; 445 // Para a regras fora do escritorio; 446 unset($tmp); 447 if ($this->newout != "") { 448 $aux = explode("&&", $this->newout); 449 $vacation['days'] = $aux[1]; 450 $vacation['addresses'] = $aux[2]; 451 $vacation['text'] = preg_replace("/\\\\n/", "\r\n", $aux[3]); 452 $vacation['status'] = $aux[4]; 453 } 454 455 // Monta a regra para fora do escritorio; 456 if ($vacation['status'] == 'on') { 457 $newscriptbody .= "vacation :days " . $vacation['days'] . " :addresses ["; 458 $newscriptbody .= $vacation['addresses']; 459 $newscriptbody .= "] text:\n" . utf8_encode($vacation['text']) . "\n.\n;\n\n"; 460 } 461 462 // Cria o cabeçalho do arquivo; 463 $newscripthead = ""; 464 $newscripthead .= "#Mail filter rules for " . $this->username . "\n"; 465 $newscripthead .= '#Generated by ' . $this->username . ' using Expressomail '; 466 $newscripthead .= "\n"; 467 468 // Continuação do cabeçalho do arquivo; 469 if ($activerules) { 470 $newscripthead .= "require [\"fileinto\""; 471 472 if ($notify) { 473 $newscripthead .= ",\"notify\""; 474 } 475 if ($regexused) { 476 $newscripthead .= ",\"regex\""; 477 } 478 if ($rejectused) { 479 $newscripthead .= ",\"reject\""; 480 } 481 if ($flaggedused) { 482 $newscripthead .= ",\"imapflags\""; 483 } 484 if ($this->newout && $vacation['status'] == 'on') { 485 $newscripthead .= ",\"vacation\""; 486 } 487 $newscripthead .= "];\n\n"; 488 } else { 489 if ($vacation && $vacation['status'] == 'on') { 490 $newscripthead .= "require [\"vacation\"];\n\n"; 491 } 492 } 493 494 // Cria o rodapé do arquivo; 495 $newscriptfoot = ""; 496 $newscriptfoot .= "##PSEUDO script start\n"; 497 // Lê as regras; 498 foreach ($this->newrules as $tmp) { 499 $newscriptfoot .= preg_replace("/[\\n\\r]/", " ", $tmp) . "\n"; 500 } 501 // Lê as regras fora do escritório; 502 if ($this->newout != "") { 503 $newscriptfoot .= preg_replace("/[\\n\\r]/", " ", $this->newout) . "\n"; 504 } 505 $newscriptfoot .= "#mode&&basic\n"; 506 507 $newscript = $newscripthead . $newscriptbody . $newscriptfoot; 508 509 // Destroi as variaveis; 510 unset($rule); 511 unset($vacation); 512 unset($activerules); 513 unset($regexused); 514 unset($rejectused); 515 unset($flaggedused); 516 unset($newscripthead); 517 unset($newscriptbody); 518 unset($newscriptfoot); 519 unset($continue); 520 unset($this->newrules); 521 unset($this->newout); 522 523 // Retorna o script construido; 524 return $newscript; 525 } 8 //Declaração de Variáveis; 9 var $SieveS; // Var para criação do objeto; 10 var $reply; // Var para resposta; 11 var $scriptfile; // Nome do script; 12 var $username; // Nome do usuario; 13 var $rules; // Regras do sieve; 14 var $errstr; // Erros retornados; 15 var $size; // Tamanho; 16 var $so; // Verifica se a regra foi criada por outro tipo serviço de filtros; 17 var $continuebit; 18 var $sizebit; 19 var $anyofbit; 20 var $keepbit; 21 var $regexbit; 22 var $newrules = array(); 23 var $newout; 24 var $teste; 25 var $EmailVoip; 26 var $EmailExpresso; 27 28 function ScriptS() { 29 30 //Cria o objeto; 31 $this->SieveS = new SieveS(); 32 33 //$this->scriptfile = $GLOBALS['HTTP_SESSION_VARS']['phpgw_info']['expressomail']['user']['account_lid']; 34 $this->scriptfile = $_SESSION['phpgw_info']['expressomail']['user']['account_lid']; 35 $this->username = $this->scriptfile; 36 37 $this->reply = ""; 38 $this->rules = ""; 39 $this->errstr = ""; 40 $this->size = ""; 41 42 $this->continuebit = 1; 43 $this->sizebit = 2; 44 $this->anyofbit = 4; 45 $this->keepbit = 8; 46 $this->regexbit = 128; 47 48 $this->EmailVoip = trim($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['voip_email_redirect']); 49 $this->EmailExpresso = trim($_SESSION['phpgw_info']['expressomail']['user']['email']); 50 } 51 52 function init_a() { 53 54 //Abre a conexão 55 $this->SieveS->start(); 56 57 $this->reply = $this->SieveS->getscript(); 58 59 if (!$this->reply) { 60 61 $aux = $this->SieveS->putscript($this->scriptfile, $this->createScript()); 62 if (!$aux) { 63 // Caso de erro, grava dentro da variável errstr; 64 $this->errstr = "Error: file not created"; 65 return $this->errstr; 66 } 67 // Mata a variavel; 68 unset($aux); 69 // Ativa o script; 70 $aux = $this->SieveS->activatescript($this->scriptfile); 71 72 if (!$aux) { 73 // Caso de erro, grava dentro da variavel errstr; 74 $this->errstr = "Error: error to activate file"; 75 return $this->errstr; 76 } else { 77 $this->reply = $this->SieveS->getscript(); 78 $this->rules = $this->readScript($this->reply); 79 } 80 } else { 81 $this->rules = $this->readScript($this->reply); 82 } 83 84 //Fecha a conexao 85 $this->SieveS->close(); 86 87 if ($this->rules) 88 return $this->rules; 89 } 90 91 function rec_rules($params) { 92 93 $newr1 = array(); 94 $newr2 = array(); 95 $newr3 = array(); 96 97 $var_decode = rawurldecode($params['arfilter']); 98 $var_decode = preg_replace('/\n\./', '.', $var_decode); 99 100 $narray = explode("_end_", $var_decode); 101 102 foreach ($narray as $key => $tmp) { 103 if ($tmp != "") { 104 $newr1[] = $tmp; 105 } 106 } 107 unset($key); 108 unset($tmp); 109 foreach ($newr1 as $key => $tmp) { 110 $tmp2 = explode("_begin_##", $tmp); 111 foreach ($tmp2 as $tmp3) { 112 if ($tmp3 != "") { 113 $newr2[] = trim($tmp3); 114 } 115 } 116 } 117 118 unset($tmp); 119 unset($tmp2); 120 unset($tmp3); 121 122 foreach ($newr2 as $tmp) { 123 if (trim($tmp) != "") { 124 $tmp2 = explode("##", $tmp); 125 foreach ($tmp2 as $tmp3) { 126 $tmp4 .= trim($tmp3) . "&&"; 127 } 128 $newr3[] = substr($tmp4, 0, (strlen($tmp4) - 4)); 129 unset($tmp2); 130 unset($tmp3); 131 unset($tmp4); 132 } 133 } 134 135 $tmp = $newr3[count($newr3) - 1]; 136 137 if (substr($tmp, 0, 9) == "#vacation") { 138 $this->newout = array_pop($newr3); 139 foreach ($newr3 as $key => $tmp) { 140 $this->newrules[] = $tmp; 141 } 142 } else { 143 foreach ($newr3 as $tmp) { 144 $this->newrules[] = $tmp; 145 } 146 } 147 148 unset($tmp); 149 $tmp = explode("&&", $this->newout); 150 $tmp1 = explode(",", $tmp[2]); 151 foreach ($tmp1 as $key => $tmp2) { 152 $tmp3 .= stripslashes(trim($tmp2)) . ", "; 153 } 154 $tmp3 = substr($tmp3, 0, (strlen($tmp3) - 2)); 155 156 unset($tmp); 157 unset($tmp1); 158 unset($tmp2); 159 unset($key); 160 $tmp = explode("&&", $this->newout); 161 foreach ($tmp as $key => $tmp1) { 162 if ($key == 2) { 163 $tmp2 .= trim($tmp3) . "&&"; 164 } else { 165 $tmp2 .= trim($tmp1) . "&&"; 166 } 167 } 168 unset($this->newout); 169 $this->newout = substr($tmp2, 0, (strlen($tmp2) - 2)); 170 171 //Abre a conexao 172 $this->SieveS->start(); 173 $this->errstr = ""; 174 175 // Escreve a nova regra; 176 $this->reply = $this->SieveS->getscript(); 177 /* 178 if($this->reply){ 179 $this->errstr = $this->SieveS->deletescript($this->scriptfile); 180 } 181 */ 182 183 $error_log_file = "/home/expressolivre/sieve_error.log"; 184 //Escreve a(s) nova(s) regra(s); 185 $newrule = $this->write_rule(); 186 if (strlen($newrule) > 0) 187 $this->errstr = $this->SieveS->putscript($this->scriptfile, $newrule); 188 else { 189 if ($_SESSION['phpgw_info']['server']['expressomail']['expressoMail_enable_log_messages'] == "True") 190 error_log(date("D M j G:i:s T Y") . ": SieveError, Invalid rule for " 191 . $_SESSION['phpgw_info']['expressomail']['user']['userid'] . "=>" 192 . $this->teste . "\nRule:" 193 . $var_decode . "\n", 3, $error_log_file); 194 return "Invalid rule\n" . $this->teste; 195 } 196 197 //Ativa o script; 198 $this->errstr = $this->SieveS->activatescript($this->scriptfile); 199 200 //Fecha a conexao 201 $this->SieveS->close(); 202 203 if ($this->errstr) { 204 return "Ok"; 205 } else { 206 if ($_SESSION['phpgw_info']['server']['expressomail']['expressoMail_enable_log_messages'] == "True") 207 error_log(date("D M j G:i:s T Y") 208 . ": SieveError, Problem for " 209 . $_SESSION['phpgw_info']['expressomail']['user']['userid'] . "=>" 210 . " " 211 . $this->SieveS->errstr . "\n", 3, $error_log_file); 212 return "Problemas na criação do arquivo!\n" . $this->teste; 213 } 214 } 215 216 function convert_specialchar($input) { 217 $special_char = false; 218 for ($i = 0; $i < strlen($input); $i++) { 219 if (preg_match('/[^a-z0-9.@~_+=&\'*^\ \-\[\]]/i', $input[$i])) { 220 $special_char = true; 221 $input = preg_replace('/\\' . $input[$i] . '/', '=' . bin2hex($input[$i]), $input); 222 } 223 } 224 225 if ($special_char) { 226 /* * 227 * When using arrays with pattern and replacement, 228 * the keys are processed in the order they appear in the array. 229 * See preg_replace in php.net/preg_replace 230 * */ 231 $patterns[0] = '/=c3/i'; 232 $patterns[1] = '/ /'; 233 $replacements[1] = ''; 234 $replacements[0] = '_'; 235 $input = preg_replace($patterns, $replacements, $input); 236 } 237 238 return($input); 239 } 240 241 // build the rule 242 function write_rule() { 243 244 // Variaveis; 245 $rule = array(); 246 $vacation = array(); 247 $newruletext = ""; 248 $activerules = 0; 249 $regexused = 0; 250 $rejectused = 0; 251 $notify = 0; 252 $flaggedused = 0; 253 $newscriptbody = ""; 254 $continue = 1; 255 $tmpSubject = ""; 256 257 $a = 0; 258 259 260 // Recebe os valores das regras; 261 foreach ($this->newrules as $tmp) 262 { 263 $tmp1 = explode("&&", $tmp); 264 $rule['priority'] = $tmp1[1]; 265 $rule['status'] = $tmp1[2]; 266 $rule['from'] = $this->convert_specialchar($tmp1[3]); 267 $rule['to'] = $this->convert_specialchar($tmp1[4]); 268 $tmpSubject = $tmp1[5]; 269 $rule['subject'] = $this->convert_specialchar($tmp1[5]); 270 $rule['action'] = $tmp1[6]; 271 $rule['action_arg'] = utf8_encode(preg_replace("/\\r\\n/", "\r\n", $tmp1[7])); 272 $rule['flg'] = $tmp1[8]; 273 $rule['field'] = $tmp1[9]; 274 $rule['field_val'] = $tmp1[10]; 275 $rule['size'] = trim($tmp1[11]); 276 $rule['continue'] = ($tmp1[8] & $this->continuebit); 277 $rule['gthan'] = ($tmp1[8] & $this->sizebit); 278 $rule['anyof'] = ($tmp1[8] & $this->anyofbit); 279 $rule['keep'] = ($tmp1[8] & $this->keepbit); 280 $rule['regexp'] = ($tmp1[8] & $this->regexbit); 281 $rule['unconditional'] = 0; 282 283 if( $a < 2 ) 284 { 285 error_log( print_r($tmp, true), 3, "/tmp/log" ); 286 287 error_log( print_r($rule, true), 3, "/tmp/log" ); 288 289 $a++; 290 } 291 292 293 if (!$rule['from'] && !$rule['to'] && !$rule['subject'] && !$rule['field'] && empty($rule['size']) && $rule['action']) { 294 $rule['unconditional'] = 1; 295 296 if ($rule['unconditional'] && ($rule['size'] == "0" || $rule['size'] == 0 )) 297 $rule['unconditional'] = 0; 298 } 299 300 unset($tmp1); 301 302 // Monta as regras; 303 if ($rule['status'] == 'ENABLED') 304 { 305 $activerules = 1; 306 307 // Condições para montagem das regras; 308 $anyall = "allof"; 309 if ($rule['anyof']) 310 $anyall = "anyof"; 311 if ($rule['regexp']) { 312 $regexused = 1; 313 } 314 $started = 0; 315 316 if (!$rule['unconditional']) { 317 if (!$continue) 318 $newruletext .= "els"; 319 $newruletext .= "if " . $anyall . " ("; 320 if ($rule['from']) { 321 if (preg_match("/^\s*!/", $rule['from'])) { 322 $newruletext .= 'not '; 323 $rule['from'] = preg_replace("/^\s*!/", "", $rule['from']); 324 } 325 $match = ':contains'; 326 if (preg_match("/\*|\?/", $rule['from'])) 327 $match = ':matches'; 328 if ($rule['regexp']) 329 $match = ':regex'; 330 $newruletext .= "header " . $match . " [\"From\"]"; 331 $newruletext .= " \"" . $rule['from'] . "\""; 332 $started = 1; 333 } 334 if ($rule['to']) { 335 if ($started) 336 $newruletext .= ", "; 337 if (preg_match("/^\s*!/", $rule['to'])) { 338 $newruletext .= 'not '; 339 $rule['to'] = preg_replace("/^\s*!/", "", $rule['to']); 340 } 341 $match = ':contains'; 342 if (preg_match("/\*|\?/", $rule['to'])) 343 $match = ':matches'; 344 if ($rule['regexp']) 345 $match = ':regex'; 346 $newruletext .= "address " . $match . " [\"To\",\"TO\",\"Cc\",\"CC\"]"; 347 $newruletext .= " \"" . $rule['to'] . "\""; 348 $started = 1; 349 } 350 if ($rule['subject']) { 351 if ($started) 352 $newruletext .= ", "; 353 if (preg_match("/^\s*!/", $rule['subject'])) { 354 $newruletext .= 'not '; 355 $rule['subject'] = preg_replace("/^\s*!/", "", $rule['subject']); 356 } 357 $match = ':contains'; 358 if (preg_match("/\*|\?/", $rule['subject'])) 359 $match = ':matches'; 360 if ($rule['regexp']) 361 $match = ':regex'; 362 $newruletext .= "header " . $match . " \"subject\""; 363 $newruletext .= " \"" . $rule['subject'] . "\""; 364 $started = 1; 365 } 366 if ($rule['field'] && $rule['field_val']) { 367 if ($started) 368 $newruletext .= ", "; 369 if (preg_match("/^\s*!/", $rule['field_val'])) { 370 $newruletext .= 'not '; 371 $rule['field_val'] = preg_replace("/^\s*!/", "", $rule['field_val']); 372 } 373 $match = ':contains'; 374 if (preg_match("/\*|\?/", $rule['field_val'])) 375 $match = ':matches'; 376 if ($rule['regexp']) 377 $match = ':regex'; 378 $newruletext .= "header " . $match . " \"" . $rule['field'] . "\""; 379 $newruletext .= " \"" . $rule['field_val'] . "\""; 380 $started = 1; 381 } 382 383 if ($rule['size'] != '') 384 { 385 if ( $rule['size'] == 0 && $rule['gthan'] ) 386 { 387 $xthan = " :over "; 388 389 if ($started) 390 $newruletext .= ", "; 391 392 $newruletext .= "size " . $xthan . "0K"; 393 $started = 1; 394 } 395 396 if ( $rule['size'] > 0 ) 397 { 398 $xthan = " :under "; 399 400 if ($rule['gthan']) 401 $xthan = " :over "; 402 if ($started) 403 $newruletext .= ", "; 404 405 $newruletext .= "size " . $xthan . $rule['size'] . "K"; 406 $started = 1; 407 } 408 } 409 } 410 411 // Don't write half rule! 412 if (strlen($newruletext) == 0) 413 return false; 414 // Actions 415 if (!$rule['unconditional']) 416 $newruletext .= ") {\n\t"; 417 418 if (preg_match("/folder/i", $rule['action'])) { 419 $newruletext .= "fileinto \"" . $rule['action_arg'] . "\";"; 420 } 421 422 if (preg_match("/reject/i", $rule['action'])) { 423 $newruletext .= "reject text: \n" . $rule['action_arg'] . "\n.\n;"; 424 $rejectused = 1; 425 } 426 if (preg_match("/flagged/i", $rule['action'])) { 427 $newruletext .= "addflag \"\\\\Flagged\";"; 428 $flaggedused = 1; 429 } 430 if (preg_match("/address/i", $rule['action'])) { 431 $newruletext .= "redirect \"" . $rule['action_arg'] . "\";"; 432 } 433 434 if (preg_match("/notify/i", $rule['action'])) { 435 $newruletext .= "notify :method \"mailto\" :options [\"" . $this->EmailVoip . "\"]:" . 436 "message \"<expressovoip><from>" . $this->EmailExpresso . "</from>" . 437 "<br/><Subject>" . utf8_encode($tmpSubject) . "</Subject></expressovoip>\";"; 438 $notify = 1; 439 } 440 441 if (preg_match("/discard/i", $rule['action'])) { 442 $newruletext .= "discard;"; 443 } 444 445 if ($rule['keep'] ) 446 { 447 $newruletext .= "\n\tfileinto \"INBOX\";"; 448 } 449 450 if (!$rule['unconditional']) 451 { 452 $newruletext .= "\n}"; 453 } 454 455 $continue = 0; 456 if ($rule['continue']) 457 $continue = 1; 458 if ($rule['unconditional']) 459 $continue = 1; 460 461 $newscriptbody .= $newruletext . "\n\n"; 462 unset($newruletext); 463 } 464 }// Fim do Foreach; 465 $this->teste = $newscriptbody; 466 // Para a regras fora do escritorio; 467 unset($tmp); 468 if ($this->newout != "") { 469 $aux = explode("&&", $this->newout); 470 $vacation['days'] = $aux[1]; 471 $vacation['addresses'] = $aux[2]; 472 $vacation['text'] = preg_replace("/\\\\n/", "\r\n", $aux[3]); 473 $vacation['status'] = $aux[4]; 474 } 475 476 // Monta a regra para fora do escritorio; 477 if ($vacation['status'] == 'on') { 478 $newscriptbody .= "vacation :days " . $vacation['days'] . " :addresses ["; 479 $newscriptbody .= $vacation['addresses']; 480 $newscriptbody .= "] text:\n" . utf8_encode($vacation['text']) . "\n.\n;\n\n"; 481 } 482 483 // Cria o cabeçalho do arquivo; 484 $newscripthead = ""; 485 $newscripthead .= "#Mail filter rules for " . $this->username . "\n"; 486 $newscripthead .= '#Generated by ' . $this->username . ' using Expressomail '; 487 $newscripthead .= "\n"; 488 489 // Continuação do cabeçalho do arquivo; 490 if ($activerules) { 491 $newscripthead .= "require [\"fileinto\""; 492 493 if ($notify) { 494 $newscripthead .= ",\"notify\""; 495 } 496 if ($regexused) { 497 $newscripthead .= ",\"regex\""; 498 } 499 if ($rejectused) { 500 $newscripthead .= ",\"reject\""; 501 } 502 if ($flaggedused) { 503 $newscripthead .= ",\"imapflags\""; 504 } 505 if ($this->newout && $vacation['status'] == 'on') { 506 $newscripthead .= ",\"vacation\""; 507 } 508 $newscripthead .= "];\n\n"; 509 } else { 510 if ($vacation && $vacation['status'] == 'on') { 511 $newscripthead .= "require [\"vacation\"];\n\n"; 512 } 513 } 514 515 // Cria o rodapé do arquivo; 516 $newscriptfoot = ""; 517 $newscriptfoot .= "##PSEUDO script start\n"; 518 // Lê as regras; 519 foreach ($this->newrules as $tmp) { 520 $newscriptfoot .= preg_replace("/[\\n\\r]/", " ", $tmp) . "\n"; 521 } 522 // Lê as regras fora do escritório; 523 if ($this->newout != "") { 524 $newscriptfoot .= preg_replace("/[\\n\\r]/", " ", $this->newout) . "\n"; 525 } 526 $newscriptfoot .= "#mode&&basic\n"; 527 528 $newscript = $newscripthead . $newscriptbody . $newscriptfoot; 529 530 // Destroi as variaveis; 531 unset($rule); 532 unset($vacation); 533 unset($activerules); 534 unset($regexused); 535 unset($rejectused); 536 unset($flaggedused); 537 unset($newscripthead); 538 unset($newscriptbody); 539 unset($newscriptfoot); 540 unset($continue); 541 unset($this->newrules); 542 unset($this->newout); 543 544 // Retorna o script construido; 545 return $newscript; 546 } 526 547 527 548 // Fim da Função 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 549 // Cria o script sieve, caso nao possua; 550 function createScript() { 551 552 // Cria o cabeçalho do arquivo; 553 $newScriptHead = ""; 554 $newScriptHead .= "#Mail filter rules for " . $this->username . "\n"; 555 $newScriptHead .= '#Generated by ' . $this->username . ' using ExpressoMail '; 556 $newScriptHead .= "\n"; 557 558 //Cria o rodapé do arquivo; 559 $newScriptFoot = ""; 560 $newScriptFoot .= "##PSEUDO Script Start\n"; 561 $newScriptFoot .= "#mode&&basic\n"; 562 563 //Para passar para o arquivo; 564 $newScript = $newScriptHead . $newScriptFoot; 565 566 return $newScript; 567 } 568 569 //Lê o conteúdo do script; 570 function readScript($scriptName) { 571 572 // Verifica se a conexão foi bem sucedida; 573 if (!$scriptName) { 574 $this->errstr = "Não foi possível conectar com o Servidor"; 575 return "false 2"; 576 } 577 578 // Recebe o conteúdo do array; 579 $lines = array(); 580 $lines = preg_split("/\n/", $scriptName); 581 582 // Pega o tamanho da regra na primeira do script; 583 $size_rule = array_shift($lines); 584 585 // Recebe o tamanho do script, pela primeira linha; 586 $this->size = trim($size_rule); 587 588 // Verifica a composição do script; 589 $line = array_shift($lines); 590 if (!preg_match("/^# ?Mail(.*)rules for/", $line)) { 591 $this->errstr = "Formato nao reconhecido"; 592 return false; 593 } 594 595 // Variaveis para a regra e o campo ferias; 596 $regexps = array('^ *##PSEUDO', '^ *#rule', '^ *#vacation', '^ *#mode'); 597 $retorno['rule'] = array(); 598 $retorno['vacation'] = array(); 599 $retorno['mode'] = array(); 600 601 $line = array_shift($lines); 602 while (isset($line)) { 603 foreach ($regexps as $regp) { 604 if (preg_match("/$regp/i", $line)) { 605 // Recebe todas as regras criadas no servidor; 606 if (preg_match("/^ *#rule&&/i", $line)) { 607 $retorno['rule'][] = $line . "\n"; 608 } 609 if (preg_match("/^ *#vacation&&/i", $line)) { 610 $retorno['vacation'][] = $line . "\n"; 611 } 612 if (preg_match("/^ *#mode&&(.*)/i", $line)) { 613 $retorno['mode'][] = $line . "\n"; 614 } 615 } 616 } 617 // Pega a proxima linha do sript; 618 $line = array_shift($lines); 619 } 620 return $retorno; 621 } 601 622 602 623 } -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/inc/class.dynamic_contacts.inc.php
r1059 r4644 79 79 { 80 80 foreach($this->contacts as $item => $valor) 81 $contact .= ';'.$this->contacts[$item]['email']. ',';81 $contact .= str_replace("#",";",$this->contacts[$item]['email']) . ','; 82 82 //Retira ultima virgula. 83 83 $contact = substr($contact,0,(strlen($contact) - 1)); … … 118 118 if(!$this->contacts) // Used one time to insert the first contact in database 119 119 { 120 $this->db->insert_contact($val-> mailbox."@".$val->host);120 $this->db->insert_contact($val->personal."#".$val->mailbox."@".$val->host); 121 121 // Just new contact added. 122 $new_contacts[] = $val-> mailbox."@".$val->host;122 $new_contacts[] = $val->personal.";".$val->mailbox."@".$val->host; 123 123 $this->contacts = $this->db->get_dynamic_contacts(); 124 124 } … … 129 129 foreach($this->contacts as $item => $valor) 130 130 { 131 if($this->contacts[$item]['email'] == $val-> mailbox."@".$val->host) // check if email already exists131 if($this->contacts[$item]['email'] == $val->personal."#".$val->mailbox."@".$val->host) // check if email already exists 132 132 { 133 133 $this->contacts[$item]['timestamp'] = time(); //update timestamp of email … … 143 143 { 144 144 // Just new contact added. 145 $new_contacts[] = $val-> mailbox."@".$val->host;145 $new_contacts[] = $val->personal.";".$val->mailbox."@".$val->host; 146 146 if($this->number_of_contacts > count($this->contacts)) 147 147 { 148 148 $this->contacts[] = array( 'timestamp' => time(), 149 'email' => $val-> mailbox."@".$val->host);149 'email' => $val->personal."#".$val->mailbox."@".$val->host); 150 150 } 151 151 if($this->number_of_contacts <= count($this->contacts)) 152 152 { 153 153 $this->contacts[$older_contact] = array( 'timestamp' => time(), 154 'email' => $val-> mailbox."@".$val->host);154 'email' => $val->personal."#".$val->mailbox."@".$val->host); 155 155 } 156 156 } -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/inc/class.imap_functions.inc.php
r4437 r4644 52 52 function open_mbox($folder = False,$force_die=true) 53 53 { 54 $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO _8859-1");54 $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO-8859-1"); 55 55 if (is_resource($this->mbox)) 56 56 { … … 120 120 121 121 if(!$search_box_type || $search_box_type=="UNSEEN" || $search_box_type=="SEEN") { 122 $msgs_info = imap_status($this->mbox,"{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".mb_convert_encoding( $folder, "UTF7-IMAP", "ISO _8859-1" ) ,SA_ALL);122 $msgs_info = imap_status($this->mbox,"{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".mb_convert_encoding( $folder, "UTF7-IMAP", "ISO-8859-1" ) ,SA_ALL); 123 123 124 124 … … 335 335 $invalid_format = false; 336 336 $filename = $params['FILES'][0]['name']; 337 $params["folder"] = mb_convert_encoding($params["folder"], "UTF7-IMAP","ISO _8859-1");337 $params["folder"] = mb_convert_encoding($params["folder"], "UTF7-IMAP","ISO-8859-1"); 338 338 $quota = imap_get_quotaroot($this->mbox, $params["folder"]); 339 339 if((($quota['limit'] - $quota['usage'])*1024) <= $params['FILES'][0]['size']){ … … 456 456 $body_part_to_show = '1'; 457 457 458 $status = imap_append($this->mbox, 459 "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".$params["folder"], 460 $header. 461 "Content-Type: ".$all_body_type."; charset = \"".$all_body_charset."\"". 462 "\r\n". 463 "Content-Transfer-Encoding: ".$all_body_encoding. 464 "\r\n". 465 "\r\n". 466 str_replace("\n","\r\n",$this->decodeBody( 467 imap_fetchbody($this->mbox,imap_msgno($this->mbox, $params["msg_num"]),$body_part_to_show), 468 $all_body_encoding, $all_body_charset 469 ) 470 ), "\\Seen"); //Append do novo email, só com header e conteúdo sem anexos. 458 if (($all_body_charset == "utf-8") && ($all_body_encoding == "base64")){ 459 $status = imap_append($this->mbox, 460 "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".$params["folder"], 461 $header. 462 "Content-Type: ".$all_body_type."; charset = \"iso-8859-1\"". 463 "\r\n". 464 "Content-Transfer-Encoding: quoted-printable". 465 "\r\n". 466 "\r\n". 467 str_replace("\n","\r\n",$this->decodeBody( 468 imap_fetchbody($this->mbox,imap_msgno($this->mbox, $params["msg_num"]),$body_part_to_show), 469 $all_body_encoding, $all_body_charset 470 ) 471 ) 472 , "\\Seen"); //Append do novo email, só com header e conteúdo sem anexos. 473 }else{ 474 $status = imap_append($this->mbox, 475 "{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".$params["folder"], 476 $header. 477 "Content-Type: ".$all_body_type."; charset = \"".$all_body_charset."\"". 478 "\r\n". 479 "Content-Transfer-Encoding: ".$all_body_encoding. 480 "\r\n". 481 "\r\n". 482 str_replace("\n","\r\n",$this->decodeBody( 483 imap_fetchbody($this->mbox,imap_msgno($this->mbox, $params["msg_num"]),$body_part_to_show), 484 $all_body_encoding, $all_body_charset 485 ) 486 ) 487 , "\\Seen"); //Append do novo email, só com header e conteúdo sem anexos. 488 } 471 489 472 490 if(!$status) … … 1388 1406 1389 1407 $pattern = "/(<\w[^>]+|[\/\"'@=])?{$url}/"; 1390 ini_set( 'pcre.backtrack_limit', 300000 ); 1408 $limit = strlen($body).strlen($body); 1409 ini_set( 'pcre.backtrack_limit', $limit ); 1410 1391 1411 1392 1412 /* … … 1622 1642 1623 1643 $return = array(); 1644 $return['new_msgs'] = imap_num_recent($this->mbox); 1624 1645 $i = 0; 1625 1646 foreach($msgs_to_exec as $msg_number) … … 1709 1730 $this->open_mbox($folder); 1710 1731 } 1711 $return['new_msgs'] = imap_num_recent($this->mbox); 1732 1712 1733 $return['msgs_to_delete'] = $msg_to_delete; 1713 1734 $return['offsetToGMT'] = $this->functions->CalculateDateOffset(); … … 1760 1781 } 1761 1782 1762 $inbox = 'INBOX';1763 $trash = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'];1783 $inbox = 'INBOX'; 1784 $trash = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']; 1764 1785 $drafts = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder']; 1765 $spam = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'];1766 $sent = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'];1786 $spam = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']; 1787 $sent = $inbox . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']; 1767 1788 $uid2cn = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['uid2cn']; 1768 1789 // Free others requests … … 1782 1803 $resultDefault = array(); 1783 1804 1784 if (is_array($folders_list)) { 1805 if ( is_array($folders_list) ) 1806 { 1785 1807 reset($folders_list); 1786 1808 $this->ldap = new ldap_functions(); 1787 1809 1788 1810 $i = 0; 1789 while (list($key, $val) = each($folders_list)) { 1790 $status = imap_status($mbox_stream, $val->name, SA_UNSEEN); 1791 1792 //$tmp_folder_id = explode("}", imap_utf7_decode($val->name)); 1793 $tmp_folder_id = explode("}", mb_convert_encoding($val->name, "ISO_8859-1", "UTF7-IMAP" )); 1794 1795 if($tmp_folder_id[1]=='INBOX'.$this->imap_delimiter.'decifradas') { 1796 //error_log('passou', 3,'/tmp/imap_get_list.log'); 1797 //imap_deletemailbox($mbox_stream,imap_utf7_encode("{".$this->imap_server."}".'INBOX/decifradas')); 1798 continue; 1799 } 1800 $result[$i]['folder_unseen'] = $status->unseen; 1801 $folder_id = $tmp_folder_id[1]; 1802 $result[$i]['folder_id'] = $folder_id; 1803 1804 $tmp_folder_parent = explode($this->imap_delimiter, $folder_id); 1805 $result[$i]['folder_name'] = array_pop($tmp_folder_parent); 1806 $result[$i]['folder_name'] = $result[$i]['folder_name'] == 'INBOX' ? 'Inbox' : $result[$i]['folder_name']; 1807 1808 if ($uid2cn && substr($folder_id,0,4) == 'user') { 1809 //$this->ldap = new ldap_functions(); 1810 if ($cn = $this->ldap->uid2cn($result[$i]['folder_name'])) { 1811 $result[$i]['folder_name'] = $cn; 1812 } 1813 } 1814 1815 $tmp_folder_parent = implode($this->imap_delimiter, $tmp_folder_parent); 1816 $result[$i]['folder_parent'] = $tmp_folder_parent == 'INBOX' ? '' : $tmp_folder_parent; 1817 1818 if (($val->attributes == 32) && ($result[$i]['folder_name'] != 'Inbox')) 1819 $result[$i]['folder_hasChildren'] = 1; 1820 else 1821 $result[$i]['folder_hasChildren'] = 0; 1822 1823 switch ($tmp_folder_id[1]) { 1824 case $inbox: 1825 case $sent: 1826 case $drafts: 1827 case $spam: 1828 case $trash: 1829 $resultDefault[]=$result[$i]; 1830 break; 1831 default: 1832 $resultMine[]=$result[$i]; 1833 } 1834 1835 $i++; 1836 } 1811 1812 while (list($key, $val) = each($folders_list)) 1813 { 1814 $status = imap_status( $mbox_stream, $val->name, SA_UNSEEN ); 1815 1816 $tmp_folder_id = explode("}", $val->name ); 1817 1818 $folderUser = trim( strpos( $tmp_folder_id[1], $this->imap_delimiter , 5 ) ); 1819 1820 $folderUser = trim( substr( $tmp_folder_id[1], 0, $folderUser ) ); 1821 1822 $Permission = true; 1823 1824 if( $folderUser != "INBOX" && $folderUser != "" ) 1825 { 1826 $Permission = imap_getacl( $mbox_stream, $folderUser ); 1827 } 1828 1829 if( $Permission ) 1830 { 1831 $tmp_folder_id[1] = mb_convert_encoding( $tmp_folder_id[1], "ISO-8859-1", "UTF7-IMAP" ); 1832 1833 if( $tmp_folder_id[1]=='INBOX'.$this->imap_delimiter.'decifradas') 1834 { 1835 //error_log('passou', 3,'/tmp/imap_get_list.log'); 1836 //imap_deletemailbox($mbox_stream,imap_utf7_encode("{".$this->imap_server."}".'INBOX/decifradas')); 1837 continue; 1838 } 1839 1840 $result[$i]['folder_unseen'] = $status->unseen; 1841 $folder_id = $tmp_folder_id[1]; 1842 $result[$i]['folder_id'] = $folder_id; 1843 1844 $tmp_folder_parent = explode($this->imap_delimiter, $folder_id); 1845 $result[$i]['folder_name'] = array_pop($tmp_folder_parent); 1846 $result[$i]['folder_name'] = $result[$i]['folder_name'] == 'INBOX' ? 'Inbox' : $result[$i]['folder_name']; 1847 1848 if ($uid2cn && substr($folder_id,0,4) == 'user') 1849 { 1850 //$this->ldap = new ldap_functions(); 1851 if ($cn = $this->ldap->uid2cn($result[$i]['folder_name'])) 1852 { 1853 $result[$i]['folder_name'] = $cn; 1854 } 1855 } 1856 1857 $tmp_folder_parent = implode($this->imap_delimiter, $tmp_folder_parent); 1858 $result[$i]['folder_parent'] = $tmp_folder_parent == 'INBOX' ? '' : $tmp_folder_parent; 1859 1860 if (($val->attributes == 32) && ($result[$i]['folder_name'] != 'Inbox')) 1861 $result[$i]['folder_hasChildren'] = 1; 1862 else 1863 $result[$i]['folder_hasChildren'] = 0; 1864 1865 switch ($tmp_folder_id[1]) 1866 { 1867 case $inbox: 1868 case $sent: 1869 case $drafts: 1870 case $spam: 1871 case $trash: 1872 $resultDefault[]=$result[$i]; 1873 break; 1874 default: 1875 $resultMine[]=$result[$i]; 1876 } 1877 } 1878 1879 $i++; 1880 } 1837 1881 } 1838 1882 … … 1925 1969 foreach($nameboxs as $key=>$tmp){ 1926 1970 if($tmp != ""){ 1927 if(!imap_createmailbox($mbox_stream,imap_utf7_encode("{".$imap_server."}$tmp"))){ 1928 $result = implode("<br />\n", imap_errors()); 1929 if($mbox_stream) 1930 imap_close($mbox_stream); 1931 return $result; 1971 $to_create_array = explode($this->imap_delimiter, $tmp); 1972 array_pop(&$to_create_array); 1973 $folder = array(); 1974 foreach($to_create_array as $k=>$to_create){ 1975 $folder[] = $to_create; 1976 if($to_create != 'INBOX') { 1977 $tmp = implode($this->imap_delimiter, $folder); 1978 if(!imap_createmailbox($mbox_stream,imap_utf7_encode("{".$imap_server."}$tmp"))){ 1979 $result = implode("<br />\n", imap_errors()); 1980 if("Mailbox already exists" != $result) { 1981 imap_close($mbox_stream); 1982 return $result; 1983 } 1984 } 1985 } 1932 1986 } 1933 1987 } … … 2095 2149 } 2096 2150 2097 $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO _8859-1");2151 $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO-8859-1"); 2098 2152 $folder_name = $params['folder_name']; 2099 2153 // Fix problem with cyrus delimiter changes. … … 2130 2184 $this->add_recipients("cc", $ccaddress, &$mail); 2131 2185 $this->add_recipients("cco", $ccoaddress, &$mail); 2186 if ($replytoaddress !="") 2187 { 2132 2188 $mail->AddReplyTo($replytoaddress); 2189 } 2133 2190 $mail->Subject = $subject; 2134 2191 $mail->IsHTML( ( array_key_exists( 'type', $params ) && in_array( strtolower( $params[ 'type' ] ), array( 'html', 'plain' ) ) ) ? strtolower( $params[ 'type' ] ) != 'plain' : true ); … … 2613 2670 $mbox_stream = $this->open_mbox($folder); 2614 2671 $newmailbox = ($params['new_folder']); 2615 $newmailbox = mb_convert_encoding($newmailbox, "UTF7-IMAP","ISO _8859-1");2672 $newmailbox = mb_convert_encoding($newmailbox, "UTF7-IMAP","ISO-8859-1"); 2616 2673 $new_folder_name = $params['new_folder_name']; 2617 2674 $msgs_number = $params['msgs_number']; … … 2739 2796 2740 2797 $folder = $params['folder']; 2741 $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO _8859-1");2798 $folder = mb_convert_encoding($folder, "UTF7-IMAP","ISO-8859-1"); 2742 2799 // Fix problem with cyrus delimiter changes. 2743 2800 // Dots in names: enabled/disabled. … … 3192 3249 $subject = lang("Read receipt: %1",$params['subject']); 3193 3250 $body = lang("Your message: %1",$params['subject']) . '<br>'; 3194 $body .= lang("Received in: %1", $params['date']) . '<br>';3251 $body .= lang("Received in: %1",date("d/m/Y H:i",$params['date'])) . '<br>'; 3195 3252 $body .= lang("Has been read by: %1 < %2 > at %3", $_SESSION['phpgw_info']['expressomail']['user']['fullname'], $_SESSION['phpgw_info']['expressomail']['user']['email'], date("d/m/Y H:i")); 3196 3253 $mail->SMTPDebug = false; … … 3367 3424 $return["has_more_msg"] = (sizeof($return["msgs"]) > $max_msgs); 3368 3425 $return["msgs"] = array_slice($return["msgs"], 0, $max_msgs); 3426 $return["msgs"]['num_msgs'] = $num_msgs; 3369 3427 3370 3428 return $return; … … 3469 3527 } 3470 3528 3471 $name_box = mb_convert_encoding(utf8_decode($name_box), "UTF7-IMAP", "ISO _8859-1" );3529 $name_box = mb_convert_encoding(utf8_decode($name_box), "UTF7-IMAP", "ISO-8859-1" ); 3472 3530 $filter = $this->remove_accents($filter); 3473 3531 … … 3485 3543 } 3486 3544 else 3487 $folder_name = mb_convert_encoding(utf8_decode($name_box), "UTF7-IMAP", "ISO _8859-1" );3545 $folder_name = mb_convert_encoding(utf8_decode($name_box), "UTF7-IMAP", "ISO-8859-1" ); 3488 3546 3489 3547 if(!is_resource($mbox_stream)) … … 3508 3566 { 3509 3567 $elem = $this->get_msg_detail($new_search,$name_box,$mbox_stream); 3510 $elem['boxname'] = mb_convert_encoding( $name_box, "ISO _8859-1", "UTF7-IMAP" );3568 $elem['boxname'] = mb_convert_encoding( $name_box, "ISO-8859-1", "UTF7-IMAP" ); 3511 3569 $elem['uid'] = $new_search; 3512 3570 /* compare dates in ordering */ … … 3553 3611 { 3554 3612 $elem = $this->get_msg_detail($new_search,$name_box,$mbox_stream); 3555 $elem['boxname'] = mb_convert_encoding( $name_box, "ISO _8859-1", "UTF7-IMAP" );3613 $elem['boxname'] = mb_convert_encoding( $name_box, "ISO-8859-1", "UTF7-IMAP" ); 3556 3614 $elem['uid'] = $new_search; 3557 3615 /* compare dates in ordering */ … … 3727 3785 }*/ 3728 3786 3729 3730 3731 3732 3733 3734 3735 3736 3737 $folder = str_replace($serverString, "", imap_utf7_decode($val->name));3738 3739 3740 3741 3742 3787 if (count($remove_share)) 3788 { 3789 foreach ($remove_share as $index=>$uid) 3790 { 3791 if (is_array($mailboxes_list)) 3792 { 3793 foreach ($mailboxes_list as $key => $val) 3794 { 3795 $folder = str_replace($serverString, "", $val->name); 3796 imap_setacl ($mbox_stream, $folder, "$uid", ""); 3797 } 3798 } 3799 } 3800 } 3743 3801 3744 3802 return true; … … 4069 4127 $quota_used = str_replace(")","",$size); 4070 4128 $quotaPercent = (($quota_used / 1024) / $data["quota_root"]["quota_limit"])*100; 4071 $folder = mb_convert_encoding($folder, "ISO _8859-1", "UTF7-IMAP");4129 $folder = mb_convert_encoding($folder, "ISO-8859-1", "UTF7-IMAP"); 4072 4130 if(!preg_match('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i',$folder)){ 4073 4131 $folder = $this->functions->getLang("Inbox"); -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/inc/class.ldap_functions.inc.php
r3909 r4644 676 676 function get_available_users2($params) 677 677 { 678 679 680 $context= $params['context'];681 $justthese = array("cn", "uid", "cn"); 682 $filter = "(&(phpgwaccounttype=u)(!(phpgwaccountvisible=-1)))"; 683 684 678 $this->ldapRootConnect(); 679 $context = $params['context']; 680 $justthese = array("cn", "uid", "cn"); 681 $filter = ( isset($params['cn']) ) ? "(&(cn=*".$params['cn']."*)(phpgwaccounttype=u)(!(phpgwaccountvisible=-1)))" : 682 "(&(phpgwaccounttype=u)(!(phpgwaccountvisible=-1)))"; 683 684 if ($this->ds) 685 685 { 686 $sr=ldap_search($this->ds, $context, $filter, $justthese); 687 $entries = ldap_get_entries($this->ds, $sr); 688 689 for ($i=0; $i<$entries["count"]; $i++){ 690 if($_SESSION['phpgw_info']['expressomail']['user']['account_lid'] != $entries[$i]["uid"][0]){ 691 $u_tmp[$entries[$i]["uid"][0]] = $entries[$i]["cn"][0]; 692 } 693 } 694 695 natcasesort($u_tmp); 696 697 $i = 0; 698 $users = array(); 699 700 if (count($u_tmp)) 701 { 702 foreach ($u_tmp as $uidnumber => $cn) 703 { 704 $options .= "<option value=$uidnumber>$cn</option>"; 705 } 706 unset($u_tmp); 707 } 708 709 ldap_close($this->ds); 710 return $options; 711 } 686 $sr = ldap_search($this->ds, $context, $filter, $justthese); 687 688 $entries = ldap_get_entries($this->ds, $sr); 689 690 for ($i=0; $i<$entries["count"]; $i++) 691 { 692 if($_SESSION['phpgw_info']['expressomail']['user']['account_lid'] != $entries[$i]["uid"][0]) 693 { 694 $u_tmp[$entries[$i]["uid"][0]] = $entries[$i]["cn"][0]; 695 } 696 } 697 698 natcasesort($u_tmp); 699 700 $i = 0; 701 $users = array(); 702 703 if (count($u_tmp)) 704 { 705 foreach ($u_tmp as $uidnumber => $cn) 706 { 707 $options .= "<option value=$uidnumber>$cn</option>"; 708 } 709 710 unset($u_tmp); 711 } 712 713 ldap_close($this->ds); 714 return $options; 715 } 712 716 } 713 717 -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/inc/hook_settings.inc.php
r3812 r4644 440 440 function getTypeSignature() { 441 441 var elementoSelects = document.getElementsByTagName('select'); 442 443 if ( elementoSelects[18].name == \"user[type_signature]\" ) {444 return elementoSelects[18];445 }446 447 442 for(i=0;i<elementoSelects.length;i++){ 448 443 if( elementoSelects[i].name == \"user[type_signature]\" ){ -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/index.php
r4300 r4644 24 24 echo '<script type="text/javascript" src="../phpgwapi/js/wz_dragdrop/wz_dragdrop.js?'.$update_version.'"></script> 25 25 <script type="text/javascript" src="../phpgwapi/js/dJSWin/dJSWin.js?'.$update_version.'"></script>'; 26 27 28 26 29 27 … … 57 55 $c->read_repository(); 58 56 $current_config = $c->config_data; 57 59 58 60 59 $_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']); … … 138 137 $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_spam'] = $current_config['expressoMail_command_for_spam']; 139 138 $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_use_spam_filter'] = $current_config['expressoMail_use_spam_filter']; 140 echo '<script> var use_spam_filter = \''.$current_config['expressoMail_use_spam_filter'].'\' 141 var sieve_forward_domains = \''.$current_config['expressoMail_sieve_forward_domains'].'\' </script>'; 142 // End Set Anti-Spam options. 139 140 echo '<script> var use_spam_filter = "'.$current_config['expressoMail_use_spam_filter'].'"</script>'; 141 echo '<script> var sieve_forward_domains = "'.$current_config['expressoMail_sieve_forward_domains'].'"</script>'; 142 // End Set Anti-Spam options. 143 144 // Begin Search Users characteres shared folders. 145 146 if( isset($current_config['expressoMail_min_num_characters'] ) ) 147 echo '<script> var sharedFolders_min_num_characters = "'.$current_config['expressoMail_min_num_characters'].'"</script>'; 148 else 149 echo '<script> var sharedFolders_min_num_characters = "" </script>'; 150 151 if( isset($current_config['expressoMail_users_auto_search']) ) 152 echo '<script> var sharedFolders_users_auto_search = "'.$current_config['expressoMail_users_auto_search'].'" </script>'; 153 else 154 echo '<script> var sharedFolders_users_auto_search = "true" </script>'; 155 156 // End Search Users characteres shared folders. 157 143 158 144 159 // Set Imap Folder names options … … 195 210 echo "<script src='js/gears_init.js?".$update_version."'></script>"; 196 211 echo '<script src="../phpgwapi/js/dftree/dftree.js?'.$update_version.'"></script>'; 212 echo '<script src="js/drag_area.js?'.$GLOBALS['phpgw_info']['apps']['expressoMail1_2']['version'].'"></script>'; 197 213 $scripts = "js/abas.js," . 198 214 "js/main.js," . 199 "js/drag_area.js," .200 215 "js/draw_api.js,"; 201 216 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages']) -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js
-
Property
svn:ignore
set to
.filter.js.swp
.filters.js.swp
.filters.js.swo
.filter_old.js.swp
.drag_area.js.swp
.main.js.swp
.messages_controller.js.swp
.local_messages.j.swp
.local_messages.js.swp
.wfolders.js.swp
-
Property
svn:ignore
set to
-
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/InfoQuota.js
r3854 r4644 90 90 table.style.marginTop = "10px"; 91 91 table.style.width="100%"; 92 table.style.height="80%"; 92 if (navigator.userAgent.toLowerCase().indexOf('chrome') == -1)// chrome == > -1 93 table.style.height="80%"; 93 94 table.style.background = "#FFF"; 94 95 table.cellSpacing = 5; … … 107 108 tr_thead.style.color = "white"; 108 109 tr_thead.style.fontWeight = "bold"; 109 tr_thead.outerHTML = tr_thead.outerHTML;110 110 thead.appendChild(tr_thead); 111 111 var th_thead = document.createElement("TH"); … … 180 180 td221.height="15px"; 181 181 td221.className = 'dsused'; 182 td221.style.width = '100%'; 182 183 tr221.appendChild(td221); 183 184 tbody221.appendChild(tr221); -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/common_functions.js
r3904 r4644 613 613 } 614 614 615 function sharebox(){ 615 function sharebox() 616 { 616 617 var handler_imap_getacl = function(data) 617 618 { 618 619 var options = ''; 619 620 for (var x in data) 620 621 { -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/drag_area.js
r4161 r4644 165 165 else if(_dragArea.msg_number && _target.type != 'checkbox') { 166 166 _dragArea.mouseMoveDrag(e); 167 }168 if (is_ie)169 window.event.returnValue = false;170 else171 e.returnValue = false;167 if (is_ie) 168 window.event.returnValue = false; 169 else 170 e.returnValue = false; 171 } 172 172 }; 173 173 -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/draw_api.js
r4331 r4644 343 343 var nm1 = ""; 344 344 if(tree_folders._folderPr.length > 0){ 345 var nm_folder = ""; 346 for(var i=0; i < tree_folders._folderPr.length; i++){ 347 nm_folder = tree_folders._folderPr[i].split(cyrus_delimiter); 348 if(nm_folder[0] == "INBOX"){ 349 if(nm1 == ""){ 350 nm1 = nm_folder[1]; 351 folder_create = "INBOX" + cyrus_delimiter + nm_folder[1] + ";"; 352 }else{ 353 if( nm1 != nm_folder[1]){ 354 folder_create += "INBOX" + cyrus_delimiter + nm_folder[1] + ";"; 355 nm1 = nm_folder[1]; 356 } 345 folder_create = tree_folders._folderPr.join(';'); 346 } 347 if(folder_create != ""){ 348 if(confirm(get_lang("There are folders with invalid format. If you want to fix now, click on button OK."))){ 349 var handler_correct_folders = function(data){ 350 //Timeout to release HTTPRequest , loadScript and update tree folders. 351 if(data){ 352 write_msg(get_lang('The folders were fixed with success.')); 353 setTimeout("connector.loadScript('TreeShow');ttreeBox.update_folder();",500); 357 354 } 358 355 } 359 }360 }361 if(folder_create != ""){362 if(confirm(get_lang("There are folders with invalid format. Do you want to fix them?"))){363 var handler_correct_folders = function(data){364 //Timeout to release HTTPRequest , loadScript and update tree folders.365 if(data)366 setTimeout("connector.loadScript('TreeShow');ttreeBox.update_folder();",500);367 }368 356 cExecute("$this.imap_functions.create_extra_mailbox",handler_correct_folders,"nw_folders="+folder_create); 357 } 358 else{ 359 write_msg(get_lang('Warning: The folders with invalid format will be unavailable.')); 369 360 } 370 361 } … … 633 624 * folder before finishing the Ajax request 634 625 */ 635 if (msg_folder != headers_msgs['folder']) { 626 if (msg_folder != headers_msgs['folder']) { 636 627 637 628 if (headers_msgs['folder']) { … … 1375 1366 } 1376 1367 1368 //Verifica se a mensagem local foi encaminhada. 1369 if (info_msg.Draft == 'X' && info_msg.Answered == 'A') 1370 info_msg.Forwarded = 'F'; 1377 1371 // NORMAL MSG 1378 if(info_msg.Draft != 'X' )1372 if(info_msg.Draft != 'X' || info_msg.Forwarded == 'F') 1379 1373 { 1380 1374 var options = document.createElement("TD"); … … 3071 3065 else 3072 3066 td221.className = 'dsused'; 3067 3068 td221.setAttribute("style","width: 100%"); 3073 3069 3074 3070 tr221.appendChild(td221); -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/filter.js
r3961 r4644 22 22 this.email_deny = new Array; 23 23 this.email_ld = ""; 24 this.values = new Array("", 25 ",select_size=1", 26 ",select_rules=1", 27 ",select_size=1,select_rules=1", 28 ",checkBox2", 29 ",checkBox2,select_size=1", 30 ",ckeckBox1,checkBox2,select_size=1", 31 ",checkBox2,select_rules=1", 32 ",checkBox2,select_size=1,select_rules=1"); 33 34 } 35 36 24 this.values = new Array("", 25 ",checkBox1", 26 ",select_size=1", 27 ",checkBox1,select_size=1", 28 ",select_rules=1", 29 ",checkBox1,select_rules=1", 30 ",select_size=1,select_rules=1", 31 ",checkBox1,select_size=1,select_rules=1", 32 ",checkBox2", 33 ",checkBox1,checkBox2", 34 ",checkBox2,select_size=1", 35 ",ckeckBox1,checkBox2,select_size=1", 36 ",checkBox2,select_rules=1", 37 ",checkBox1,checkBox2,select_rules=1", 38 ",checkBox2,select_size=1,select_rules=1", 39 ",checkBox1,checkBox2,select_size=1,select_rules=1"); 40 41 } 42 37 43 cfilter.prototype.load_rules = function(posHandler, param) 38 44 { … … 184 190 document.getElementById("field2").value = fields[4]; 185 191 document.getElementById("field3").value = fields[5]; 186 document.getElementById("field4").value = fields[11] ;192 document.getElementById("field4").value = fields[11] == 0 ? "" : fields[11]; 187 193 188 194 switch(fields[6]){ … … 646 652 opts += ",select_rules=1"; 647 653 } 648 for(var i=0; i < this.values.length; i++){ 649 if(this.values[i] == opts){ 654 for(var i=0; i < this.values.length; i++) 655 { 656 if(this.values[i] == opts) 657 { 650 658 mount_rule += i + "&&"; 651 659 } -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/filters.js
r4238 r4644 146 146 147 147 cfilterSh.prototype.vl_rule = function(rule,pos,type) 148 { 149 var fields = rule.split("&&"); 150 if(type == 'voip') 151 return " <a href='javascript:void(0)' onclick=filter.form_r('"+pos+"','voip')><b>" + get_lang("Status") + " : </b>" + "<font color='red'>" + get_lang(fields[2]) + "</font>" + " - " + fields[3] + " <b>" + get_lang("Subject") + ":</b> " + fields[5] + "</a>"; 152 else{ 153 var _criteria = " "; 154 if (fields[3].length > 0) 155 _criteria = "<b>"+get_lang("is from")+"</b>:"+fields[3]; 156 if (fields[4].length > 0) 157 _criteria += "<b> "+get_lang("is to")+"</b>:"+fields[4]; 158 if (fields[5].length > 0) 159 _criteria += "<b> "+get_lang("subject is")+"</b>:"+fields[5]; 160 if (parseInt(fields[11]) >= 0) 161 { 162 if(fields[8] == "1") 163 _criteria += "<b> "+get_lang("size is over than")+"</b>:"+fields[11]; 164 else 165 _criteria += "<b> "+get_lang("size is under than")+"</b>:"+fields[11]; 166 } 167 var _action = " "; 168 if (fields[6] == 'folder') 148 { 149 var fields = rule.split("&&"); 150 if(type == 'voip') 151 { 152 return " <a href='javascript:void(0)' onclick=filter.form_r('"+pos+"','voip')><b>" + get_lang("Status") + " : </b>" + "<font color='red'>" + get_lang(fields[2]) + "</font>" + " - " + fields[3] + " <b>" + get_lang("Subject") + ":</b> " + fields[5] + "</a>"; 153 } 154 else 155 { 156 var _criteria = " "; 157 if (fields[3].length > 0) 158 _criteria = "<b>"+get_lang("is from")+"</b>:"+fields[3]; 159 if (fields[4].length > 0) 160 _criteria += "<b> "+get_lang("is to")+"</b>:"+fields[4]; 161 if (fields[5].length > 0) 162 _criteria += "<b> "+get_lang("subject is")+"</b>:"+fields[5]; 163 if ( parseInt( fields[11] ) > 0 ) 164 { 165 if( fields[8] == "2" || fields[8] == "10" ) 166 _criteria += "<b> "+get_lang("size is over than")+"</b>:"+fields[11]; 167 168 if( fields[8] == "0" || fields[8] == "8" ) 169 _criteria += "<b> "+get_lang("size is under than")+"</b>:"+fields[11]; 170 } 171 172 var _action = " "; 173 if (fields[6] == 'folder') 169 174 { 170 var _folderName = ( (fields[7].split(cyrus_delimiter))[1] != undefined ) ? (fields[7].split(cyrus_delimiter))[ 1] : fields[7];175 var _folderName = ( (fields[7].split(cyrus_delimiter))[1] != undefined ) ? (fields[7].split(cyrus_delimiter))[2] != undefined ? (fields[7].split(cyrus_delimiter))[2] : (fields[7].split(cyrus_delimiter))[1] : fields[7]; 171 176 _action = get_lang("Store at")+" "+ lang_folder( _folderName ); 172 177 } 173 else if (fields[6] == 'address') 174 _action = get_lang("Forward to")+ " "+(fields[7]); 175 else 176 _action = get_lang(fields[6]); 177 return " <a href='javascript:void(0)' onclick=filter.form_r('"+pos+"','')><b>" + get_lang("Status") + " : </b>" + "<font color='red'>" + get_lang(fields[2]) + "</font>" + " - <b>" + get_lang("if email") + " </b>" + _criteria + " - <b>" + get_lang("Action") + ":</b> " + _action + "</a>"; 178 } 179 } 180 181 cfilterSh.prototype.vl_outOffice = function(outOffice){ 178 else if (fields[6] == 'address') 179 _action = get_lang("Forward to")+ " "+(fields[7]); 180 else 181 _action = get_lang(fields[6]); 182 return " <a href='javascript:void(0)' onclick=filter.form_r('"+pos+"','')><b>" + get_lang("Status") + " : </b>" + "<font color='red'>" + get_lang(fields[2]) + "</font>" + " - <b>" + get_lang("if email") + " </b>" + _criteria + " - <b>" + get_lang("Action") + ":</b> " + _action + "</a>"; 183 } 184 } 185 186 cfilterSh.prototype.vl_outOffice = function(outOffice) 187 { 182 188 var aux = outOffice.split("&&"); 183 189 return get_lang("Rule") + " - <a href='javascript:void(0)' onclick=filter.form_out()> " + "<b>" + get_lang("Status") + " : </b><font color='red'>" + (aux[4] == "off" ? get_lang("Disabled") : get_lang("Enabled")) + "</font></a>"; -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/main.js
r4379 r4644 660 660 } 661 661 662 function move_msgs2(folder, msgs_number, border_ID, new_folder, new_folder_name,show_success_msg){ 663 if (! folder || folder == 'null') 664 folder = Element("input_folder_"+msgs_number+"_r") ? Element("input_folder_"+msgs_number+"_r").value : (openTab.imapBox[currentTab] ? openTab.imapBox[currentTab]:get_current_folder()); 665 if(openTab.type[currentTab] == 1) 666 return move_search_msgs('content_id_'+currentTab,new_folder,new_folder_name); 667 668 var handler_move_msgs = function(data){ 669 if(typeof(data) == 'string') 670 if (data.match(/^(.*)TRYCREATE(.*)$/)){ 671 connector.loadScript('TreeS'); 672 var move_to_folder = data.match(/^(.*)Spam(.*)$/) ? "Spam" : trashfolder; 673 alert(get_lang('There is not %1 folder, Expresso is creating it for you... Please, repeat your request later.', move_to_folder)); 674 connector.loadScript('TreeShow'); 675 ttree.FOLDER = 'root'; 676 ttreeBox.new_past(move_to_folder); 677 return false; 678 }else{ 679 alert(get_lang('Error moving message.')+":\n"+data); 680 return false; 681 } 682 //Este bloco verifica as permissoes ACL sobre pastas compartilhadas 683 if(data.status == false){ 684 alert(get_lang("You don't have permission for this operation in this shared folder!")); 685 return false; 686 } 687 mail_msg = ( Element("divScrollMain_"+numBox) ) ? Element("divScrollMain_"+numBox).firstChild.firstChild : Element("divScrollMain_0").firstChild.firstChild; 688 if (data.msgs_number.length == 1) 689 write_msg(get_lang("The message was moved to folder ") + lang_folder(data.new_folder_name)); 690 else 691 write_msg(get_lang("The messages were moved to folder ") + lang_folder(data.new_folder_name)); 692 693 if (openTab.type[currentTab] > 1){ 694 msg_to_delete = Element(msgs_number); 695 if (parseInt(preferences.delete_and_show_previous_message) && msg_to_delete) 696 { 697 if (msg_to_delete.previousSibling){ 698 var previous_msg = msg_to_delete.previousSibling.id; 699 //cExecute("$this.imap_functions.get_info_msg&msg_number="+previous_msg+"&msg_folder=" + current_folder, show_msg); 700 cExecute("$this.imap_functions.get_info_msg&msg_number="+previous_msg+"&msg_folder=" + url_encode(folder), show_msg); 701 } 702 else 703 delete_border(currentTab,'false'); 704 } 705 else 706 delete_border(currentTab,'false'); 707 if(msg_to_delete) 708 mail_msg.removeChild(msg_to_delete); 709 710 // Update Box BgColor 711 var box = Element("tbody_box"); 712 if(box.childNodes.length > 0){ 713 updateBoxBgColor(box.childNodes); 714 } 715 return; 716 } 717 718 Element('chk_box_select_all_messages').checked = false; 719 if (! mail_msg) 720 mail_msg = Element("tbody_box"); 721 data.msgs_number = data.msgs_number.split(","); 722 723 var msg_to_delete; 724 if( typeof(msgs_number) == 'string' ) 725 all_search_msg = msgs_number.split(','); 726 else if( typeof(msgs_number) == 'number') 727 all_search_msg = msgs_number; 728 729 for (var i=0; i <= all_search_msg.length; i++) 730 { 731 msg_to_delete = Element(folder+';'+all_search_msg[i]); 732 if (msg_to_delete) 733 msg_to_delete.parentNode.removeChild(msg_to_delete); 734 } 735 736 if ( preferences.use_shortcuts == '1') { 737 var all_messages = Element('tbody_box').childNodes; 738 739 //Last msg is selected 740 if ( exist_className(all_messages[all_messages.length-1], 'selected_shortcut_msg') ) { 741 select_msg('null', 'up', true); 742 } 743 else { 744 if (!select_msg('null', 'down', true)) { 745 select_msg('null', 'up', true); 746 } 747 } 748 } 749 for (var i=0; i<data.msgs_number.length; i++) 750 { 751 msg_to_delete = Element(data.msgs_number[i]); 752 if (msg_to_delete) 753 mail_msg.removeChild(msg_to_delete); 754 } 755 756 757 if (data.msgs_number.length == 1) 758 write_msg(get_lang("The message was moved to folder ") + lang_folder(data.new_folder_name)); 759 else 760 write_msg(get_lang("The messages were moved to folder ") + lang_folder(data.new_folder_name)); 761 if (data.border_ID.indexOf('r') != -1){ 762 if (parseInt(preferences.delete_and_show_previous_message) && folder == get_current_folder()){ 763 delete_border(data.border_ID,'false'); 764 show_msg(data.previous_msg); 765 } 766 else 767 delete_border(data.border_ID,'false'); 768 } 769 if(folder == get_current_folder()) 770 Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) - data.msgs_number.length; 771 772 refresh(); 773 } 774 775 if (folder == new_folder){ 776 write_msg(get_lang('The origin folder and the destination folder are the same.')); 777 return; 778 } 779 780 if (msgs_number == 'selected'){ 781 msgs_number = get_selected_messages(); 782 } 783 784 if(openTab.type[currentTab] == 1){ 785 return move_search_msgs('content_id_'+currentTab,new_folder,new_folder_name); 786 } 787 788 if(currentTab.toString().indexOf("_r") != -1){ 789 msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); 790 } 791 792 if (parseInt(msgs_number) > 0 || msgs_number.length > 0) 793 cExecute ("$this.imap_functions.move_messages&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+preferences.delete_and_show_previous_message, handler_move_msgs); 794 else 795 write_msg(get_lang('No selected message.')); 796 797 } 662 function move_msgs2(folder, msgs_number, border_ID, new_folder, new_folder_name,show_success_msg) 663 { 664 if (! folder || folder == 'null') 665 folder = Element("input_folder_"+msgs_number+"_r") ? Element("input_folder_"+msgs_number+"_r").value : (openTab.imapBox[currentTab] ? openTab.imapBox[currentTab]:get_current_folder()); 666 if(openTab.type[currentTab] == 1) 667 return move_search_msgs('content_id_'+currentTab,new_folder,new_folder_name); 668 669 var handler_move_msgs = function(data) 670 { 671 if(typeof(data) == 'string') 672 { 673 if (data.match(/^(.*)TRYCREATE(.*)$/)) 674 { 675 connector.loadScript('TreeS'); 676 var move_to_folder = data.match(/^(.*)Spam(.*)$/) ? "Spam" : trashfolder; 677 alert(get_lang('There is not %1 folder, Expresso is creating it for you... Please, repeat your request later.', move_to_folder)); 678 connector.loadScript('TreeShow'); 679 ttree.FOLDER = 'root'; 680 ttreeBox.new_past(move_to_folder); 681 return false; 682 } 683 else 684 { 685 alert(get_lang('Error moving message.')+":\n"+data); 686 return false; 687 } 688 } 689 690 //Este bloco verifica as permissoes ACL sobre pastas compartilhadas 691 if( data.status == false ) 692 { 693 alert(get_lang("You don't have permission for this operation in this shared folder!")); 694 return false; 695 } 696 697 mail_msg = ( Element("divScrollMain_"+numBox) ) ? Element("divScrollMain_"+numBox).firstChild.firstChild : Element("divScrollMain_0").firstChild.firstChild; 698 699 if ( data.msgs_number.length == 1 ) 700 { 701 write_msg(get_lang("The message was moved to folder ") + lang_folder(data.new_folder_name)); 702 } 703 else 704 { 705 write_msg(get_lang("The messages were moved to folder ") + lang_folder(data.new_folder_name)); 706 } 707 708 if ( openTab.type[currentTab] > 1 ) 709 { 710 msg_to_delete = Element( data.msgs_number ); 711 712 if ( parseInt(preferences.delete_and_show_previous_message) && msg_to_delete ) 713 { 714 if ( msg_to_delete.previousSibling ) 715 { 716 var previous_msg = msg_to_delete.previousSibling.id; 717 cExecute("$this.imap_functions.get_info_msg&msg_number="+previous_msg+"&msg_folder=" + url_encode(folder), show_msg); 718 } 719 else 720 { 721 delete_border( data.border_ID, 'false' ); 722 } 723 } 724 else 725 { 726 delete_border( data.border_ID, 'false' ); 727 } 728 729 if( msg_to_delete != null ) 730 { 731 msg_to_delete.parentNode.removeChild( msg_to_delete ); 732 //mail_msg.removeChild(msg_to_delete); 733 } 734 735 if( data.border_ID.toString().indexOf("_r") > -1 ) 736 { 737 var _msgSearch = data.border_ID.toString(); 738 _msgSearch = _msgSearch.substr(0, _msgSearch.indexOf("_r") ); 739 740 if( Element(_msgSearch) != null ) 741 { 742 Element(_msgSearch).parentNode.removeChild( Element(_msgSearch) ); 743 } 744 } 745 746 // Update Box BgColor 747 if( Element("tbody_box") != null ) 748 { 749 var box = Element("tbody_box"); 750 751 if( box.childNodes.length > 0) 752 { 753 updateBoxBgColor(box.childNodes); 754 } 755 } 756 } 757 else 758 { 759 Element('chk_box_select_all_messages').checked = false; 760 if (! mail_msg) 761 mail_msg = Element("tbody_box"); 762 data.msgs_number = data.msgs_number.split(","); 763 764 var msg_to_delete; 765 if( typeof(msgs_number) == 'string' ) 766 all_search_msg = msgs_number.split(','); 767 else if( typeof(msgs_number) == 'number') 768 all_search_msg = msgs_number; 769 770 for (var i=0; i <= all_search_msg.length; i++) 771 { 772 msg_to_delete = Element(folder+';'+all_search_msg[i]); 773 if (msg_to_delete) 774 msg_to_delete.parentNode.removeChild(msg_to_delete); 775 } 776 777 if ( preferences.use_shortcuts == '1') { 778 var all_messages = Element('tbody_box').childNodes; 779 780 //Last msg is selected 781 if ( exist_className(all_messages[all_messages.length-1], 'selected_shortcut_msg') ) { 782 select_msg('null', 'up', true); 783 } 784 else { 785 if (!select_msg('null', 'down', true)) { 786 select_msg('null', 'up', true); 787 } 788 } 789 } 790 for (var i=0; i<data.msgs_number.length; i++) 791 { 792 msg_to_delete = Element(data.msgs_number[i]); 793 if (msg_to_delete) 794 mail_msg.removeChild(msg_to_delete); 795 } 796 797 798 if (data.msgs_number.length == 1) 799 write_msg(get_lang("The message was moved to folder ") + lang_folder(data.new_folder_name)); 800 else 801 write_msg(get_lang("The messages were moved to folder ") + lang_folder(data.new_folder_name)); 802 if (data.border_ID.indexOf('r') != -1){ 803 if (parseInt(preferences.delete_and_show_previous_message) && folder == get_current_folder()){ 804 delete_border(data.border_ID,'false'); 805 show_msg(data.previous_msg); 806 } 807 else 808 delete_border(data.border_ID,'false'); 809 } 810 if(folder == get_current_folder()) 811 Element('tot_m').innerHTML = parseInt(Element('tot_m').innerHTML) - data.msgs_number.length; 812 813 refresh(); 814 } 815 816 }// END VAR HANDLER_MOVE_MSG 817 818 if (msgs_number == 'selected') 819 { 820 msgs_number = get_selected_messages(); 821 } 822 823 if(openTab.type[currentTab] == 1) 824 { 825 return move_search_msgs('content_id_'+currentTab,new_folder,new_folder_name); 826 } 827 828 if(currentTab.toString().indexOf("_r") != -1) 829 { 830 msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf("_r")); 831 border_ID = currentTab.toString(); 832 } 833 834 if( msgs_number.toString().indexOf("_s") != -1 ) 835 { 836 folder = Element(msgs_number).getAttribute("name"); 837 msgs_number = msgs_number.toString().substr(0 ,msgs_number.toString().indexOf("_s") ); 838 } 839 840 if ( folder == new_folder ) 841 { 842 write_msg(get_lang('The origin folder and the destination folder are the same.')); 843 return; 844 } 845 846 if (parseInt(msgs_number) > 0 || msgs_number.length > 0) 847 cExecute ("$this.imap_functions.move_messages&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+preferences.delete_and_show_previous_message, handler_move_msgs); 848 else 849 write_msg(get_lang('No selected message.')); 850 851 } 852 798 853 799 854 function move_msgs(folder, msgs_number, border_ID, new_folder, new_folder_name) { … … 843 898 { 844 899 845 if (numBox > 0) { 846 id_mensagem = main_list[j].id.split('_'); 847 check_box = Element("search_" + numBox + "_check_box_message_" + id_mensagem[0]); 848 } 849 else 850 check_box = Element("check_box_message_" + main_list[j].id); 900 if ( (!isNaN(parseInt(numBox))) && (numBox == 0)) { 901 check_box = Element("check_box_message_" + main_list[j].id); 902 }else { 903 id_mensagem = main_list[j].id.split('_'); 904 check_box = Element("search_" + numBox + "_check_box_message_" + id_mensagem[0]); 905 } 906 907 if ((check_box) && (check_box.checked)) { 908 909 var numericTest = /^[0-9]+$/; 910 if (numericTest.test(main_list[j].id)) 911 selected_messages += main_list[j].id + ','; 912 else 913 selected_messages += id_mensagem[0] + ','; 851 914 852 if ( (check_box) && (check_box.checked) ) 853 selected_messages += main_list[j].id + ','; 854 915 } 916 855 917 if (preferences.use_shortcuts == '1') 856 918 { … … 860 922 } 861 923 } 924 862 925 } 863 926 selected_messages = selected_messages.substring(0,(selected_messages.length-1)); … … 1227 1290 a_tmp[2] = "'"+tmp.substring(0,tmp.length-1)+"'"; 1228 1291 s_tmp = trim(escape(connector.serialize(a_tmp))); 1229 1292 1230 1293 divFiles.innerHTML += "<input style='border:0' type='CHECKBOX' name='forwarding_attachments[]' checked value=\""+s_tmp+"\"/>"; 1231 1294 divFiles.innerHTML += "<link style='border:0' name='file_"+i+"' id='inputFile_"+border_ID+i+"'/>"; … … 1336 1399 var divFiles = Element("divFiles_"+new_border_ID); 1337 1400 if (Element("attachments_" + border_ID)){ 1338 var attachments = document.getElementById("attachments_" + border_ID). childNodes;1401 var attachments = document.getElementById("attachments_" + border_ID).getElementsByTagName("a"); 1339 1402 for (var i = (attachments.length > 1 ? 1 : 0); i < attachments.length; i++){ 1403 if((attachments[i].tagName=="SPAN") || (attachments[i].tagName=="IMG") || 1404 ((attachments[i].href.indexOf("javascript:download_local_attachment")==-1)&&(attachments[i].href.indexOf("javascript:download_attachments")==-1))) 1405 continue; 1340 1406 var link_attachment = document.createElement("A"); 1341 1407 link_attachment.setAttribute("href", attachments[i].href); … … 1345 1411 tmp = link_attachment.innerHTML.substring(0,link_attachment.innerHTML.lastIndexOf("(")); 1346 1412 a_tmp[2] = "'"+tmp.substring(0,tmp.length-1)+"'"; 1347 s_tmp = trim(escape(connector.serialize(a_tmp))); 1413 //s_tmp = trim(escape(connector.serialize(a_tmp))); 1414 s_tmp = escape(connector.serialize(a_tmp)); 1348 1415 divFiles.innerHTML += "<input style='border:0' type='CHECKBOX' name='forwarding_attachments[]' checked value=\""+s_tmp+"\"/>"; 1349 1416 divFiles.appendChild(link_attachment); … … 1552 1619 for(var j in ar_contacts){ 1553 1620 // If the dynamic contact don't exist, update the autocomplete.... 1554 if((contacts+",").indexOf( ";"+ar_contacts[j]+",") == -1)1555 contacts += ", ;" + ar_contacts[j];1621 if((contacts+",").indexOf(ar_contacts[j]+",") == -1) 1622 contacts += "," + ar_contacts[j]; 1556 1623 } 1557 1624 } … … 1679 1746 textArea.name = "body"; 1680 1747 body = document.getElementById("body_"+ID); 1681 textArea.value = ( ( mail_as_plain ) ? body.previousSibling.value: ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) );1748 textArea.value = ( ( mail_as_plain ) ? (is_ie ? body.contentWindow.document.body.innerHTML : body.previousSibling.value) : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); 1682 1749 var input_folder = document.createElement("INPUT"); 1683 1750 input_folder.style.display='none'; … … 1718 1785 mail_type.name = 'type'; 1719 1786 mail_type.value = ( mail_as_plain ) ? 'plain' : 'html'; 1720 form. parentNode.appendChild(mail_type);1787 form.appendChild(mail_type); 1721 1788 1722 1789 var _subject = trim(Element("subject_"+ID).value); … … 1949 2016 tmp_folder_id=folder_id; 1950 2017 message_id = openTab.imapUid[border_id]; 1951 var handler_save_msg = function(data){ return_save(data,this.tmp_border_id,this.tmp_folder_name,this.tmp_folder_id,this.message_id); }2018 var handler_save_msg = function(data){ return_save(data,this.tmp_border_id,this.tmp_folder_name,this.tmp_folder_id,this.message_id); } 1952 2019 1953 2020 var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + border_id ); … … 1995 2062 mail_type.setAttribute('type', 'hidden'); 1996 2063 mail_type.value = ( mail_as_plain ) ? 'plain' : 'html'; 1997 form. parentNode.appendChild(mail_type);2064 form.appendChild(mail_type); 1998 2065 1999 2066 cExecuteForm ("$this.imap_functions.save_msg", form, handler_save_msg,border_id); … … 2258 2325 var attachs = ""; 2259 2326 var show_attachs = ""; 2260 for(i=3;i<a.length;i++) 2327 var ii = a.length >2?2:1; 2328 for(i=ii;i<a.length;i++) 2261 2329 { 2262 2330 if(a[i].tagName && a[i].tagName == "A") -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/rich_text_editor.js
r4379 r4644 163 163 164 164 if (source) { 165 var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + this.id ); 165 166 if (is_ie){ 166 167 connector.loadScript('html2xhtml'); 167 168 html = frames[this.editor].document.body; 168 169 var xhtml = get_xhtml(html, 'en', 'iso-8859-1'); 170 xhtml = xhtml.replace( /<br\s*\/?>/mg, "\n" ).replace( /(<([^>]+)>)/ig, '' ).replace( /^[\n ]+|[\n ]+$/g, '' ); 171 if ( ! mobile_device && xhtml != '' && ! ( mail_as_plain.checked = confirm( get_lang( 'The text format will be lost' ) + '.' ) ) ) 172 return false; 169 173 frames[this.editor].document.body.innerText = xhtml; 170 174 document.getElementById("table_richtext_toolbar").style.visibility="hidden"; 171 175 } 172 176 else{ 173 var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + this.id );174 175 177 html = document.createTextNode( editor.contentWindow.document.body.innerHTML ); 176 178 html = html.nodeValue.replace( /<br\s*\/?>/mg, "\n" ).replace( /(<([^>]+)>)/ig, '' ).replace( /^[\n ]+|[\n ]+$/g, '' ); -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/search.js
r4146 r4644 431 431 { 432 432 td.style.width = "1%"; 433 var td1 = '<input type="checkbox" id=" check_box_message_'+uid_msg+'"></input>';433 var td1 = '<input type="checkbox" id="search_' + numBox + '_check_box_message_'+uid_msg+'"></input>'; 434 434 435 435 } … … 1095 1095 else 1096 1096 { 1097 if( tmp.length > 0)1097 if( (tmp.length > 0) && (!data['num_msgs']) ) 1098 1098 { 1099 1099 EsearchE.viewLocalMessage(); -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/js/sharemailbox.js
r4082 r4644 4 4 this.el; 5 5 this.alert = false; 6 } 7 8 cShareMailbox.prototype.get_available_users = function(context) 9 { 10 var handler_get_available_users = function(data) 11 { 12 select_available_users = document.getElementById('em_select_available_users'); 13 14 //Limpa o select 15 for(var i=0; i<select_available_users.options.length; i++) 16 { 17 select_available_users.options[i] = null; 18 i--; 19 } 20 21 if ((data) && (data.length > 0)) 22 { 23 // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. 24 select_available_users.innerHTML = '#' + data; 25 select_available_users.outerHTML = select_available_users.outerHTML; 26 27 select_available_users.disabled = false; 28 select_available_users_clone = document.getElementById('em_select_available_users').cloneNode(true); 29 document.getElementById('em_input_searchUser').value = ''; 30 } 31 } 32 cExecute ("$this.ldap_functions.get_available_users2&context="+context, handler_get_available_users); 6 this.context = ""; 7 this.finderTimeout = ''; 8 } 9 10 cShareMailbox.prototype.get_available_users = function(context) 11 { 12 if( sharedFolders_users_auto_search.toString() === "true" ) 13 { 14 this.get_available_users2(context); 15 } 16 } 17 18 cShareMailbox.prototype.get_available_users2 = function() 19 { 20 var context = ""; 21 var cn = ""; 22 23 var handler_get_available_users = function(data) 24 { 25 select_available_users = document.getElementById('em_select_available_users'); 26 27 //Limpa o select 28 for(var i=0; i<select_available_users.options.length; i++) 29 { 30 select_available_users.options[i] = null; 31 i--; 32 } 33 34 if ((data) && (data.length > 0)) 35 { 36 // Necessario, pois o IE6 tem um bug que retira o primeiro options se o innerHTML estiver vazio. 37 select_available_users.innerHTML = '#' + data; 38 select_available_users.outerHTML = select_available_users.outerHTML; 39 40 select_available_users.disabled = false; 41 select_available_users_clone = document.getElementById('em_select_available_users').cloneNode(true); 42 document.getElementById('em_input_searchUser').value = ''; 43 } 44 } 45 46 if( arguments.length > 1 ) 47 { 48 context = arguments[0]; 49 cn = arguments[1]; 50 cExecute ("$this.ldap_functions.get_available_users2&context="+context+"&cn="+cn, handler_get_available_users); 51 } 52 else 53 { 54 context = arguments[0]; 55 cExecute ("$this.ldap_functions.get_available_users2&context="+context, handler_get_available_users); 56 } 57 33 58 } 34 59 … … 130 155 131 156 var el = document.createElement("DIV"); 132 el.style.visibility = "hidden"; 133 el.style.position = "absolute"; 134 el.style.left = "0px"; 135 el.style.top = "0px"; 136 el.style.width = "0px"; 137 el.style.height = "0px"; 138 el.id = 'dJSWin_sharefolders'; 139 document.body.appendChild(el); 157 el.style.visibility = "hidden"; 158 el.style.position = "absolute"; 159 el.style.left = "0px"; 160 el.style.top = "0px"; 161 el.style.width = "0px"; 162 el.style.height = "0px"; 163 el.id = 'dJSWin_sharefolders'; 164 165 document.body.appendChild(el); 140 166 141 167 if (Element('em_select_sharefolders_users')) 142 168 { 143 169 var select_users = Element('em_select_sharefolders_users'); 144 145 146 147 Element('em_input_readAcl').checked = false;148 Element('em_input_deleteAcl').checked = false;149 Element('em_input_writeAcl').checked = false;150 Element('em_input_sendAcl').checked = false;151 Element('em_input_saveAcl').checked = false;170 select_users.innerHTML = '#' + options; 171 select_users.outerHTML = select_users.outerHTML; 172 173 Element('em_input_readAcl').checked = false; 174 Element('em_input_deleteAcl').checked = false; 175 Element('em_input_writeAcl').checked = false; 176 Element('em_input_sendAcl').checked = false; 177 Element('em_input_saveAcl').checked = false; 152 178 } 153 179 else 154 180 { 155 el.innerHTML = "<table border=0><tbody><tr>"+ 156 157 "<td valign='bottom'>"+ 158 '<font color="red">'+ 159 get_lang('Note: This sharing will take action on all of your folders and messages.')+ 160 '<br><br>'+ 161 '</font>'+ 162 get_lang('Your mailbox is shared with') 163 +":<br><br>"+ 164 "<select onchange=sharemailbox.getaclfromuser(this.value); id='em_select_sharefolders_users' size='13' style='width:250px;height:200px'>" + options + "</select>"+ 165 "</td>"+ 166 167 "<td>"+ 168 '<br><br><br><br><br><br>'+ 169 '<img onClick="javascript:sharemailbox.add_user();" src="templates/'+template+'/images/arrow_left.gif" style="vertical-align:middle;cursor:pointer;">' + 170 '<br><br>'+ 171 '<img onClick="javascript:sharemailbox.remove_user();" src="templates/'+template+'/images/arrow_right.gif" style="vertical-align:middle;cursor:pointer;">' + 172 "</td>"+ 173 174 "<td valign='bottom'><br>"+ 175 get_lang('Organization')+": " + 176 "<select id='em_combo_org' onchange='javascript:sharemailbox.get_available_users(this.value);'></select>"+ 177 178 "<br><br>"+get_lang('Search user')+":<br>" + 179 '<input id="em_input_searchUser" size="35" autocomplete="off" onkeyup="javascript:sharemailbox.optionFinderTimeout(this)"><br>'+ 180 181 '<font color="red"><span id="em_span_searching"> </span></font><br>'+ 182 183 "<select id='em_select_available_users' style='width:250px;height:200px' multiple></select></td>"+ 184 '</tr>'+ 185 '<tr><td>'+ 186 '<table border=0><tbody><tr><td colspan=2>'+ 187 get_lang('Access right')+':'+ 188 '</td></tr>'+ 189 '<tr><td>'+get_lang('Read')+':</td><td><input id=\'em_input_readAcl\' onClick="return sharemailbox.setaclfromuser();" type="checkbox"><img title="'+get_lang("hlp_msg_read_acl")+'." src=\'./templates/'+template+'/images/ajuda.jpg\'></td></tr>'+ 190 '<tr><td>'+get_lang('Exclusion')+':</td><td><input id=\'em_input_deleteAcl\' onClick="return sharemailbox.setaclfromuser();" type="checkbox"><img title="'+get_lang('hlp_msg_delmov_acl')+'." src=\'./templates/'+template+'/images/ajuda.jpg\'></td></tr>'+ 191 '<tr><td>'+get_lang('Write')+':</td><td><input id=\'em_input_writeAcl\' onClick="return sharemailbox.setaclfromuser();" type="checkbox"><img title="'+get_lang('hlp_msg_addcreate_acl')+'." src=\'./templates/'+template+'/images/ajuda.jpg\'></td></tr>'+ 192 '<tr><td>'+get_lang('Send')+':</td><td><input id=\'em_input_sendAcl\' onClick="return sharemailbox.setaclfromuser();" type="checkbox"><img title="'+get_lang('hlp_msg_sendlike_acl')+'." src=\'./templates/'+template+'/images/ajuda.jpg\'></td></tr>'+ 193 '<tr><td>'+get_lang('Save')+':</td><td><input id=\'em_input_saveAcl\' onClick="return sharemailbox.setaclfromuser();" type="checkbox"><img title="'+get_lang('hlp_msg_savelike_acl')+'." src=\'./templates/'+template+'/images/ajuda.jpg\'></td></tr></tbody></table>'+ 194 '</td></tr>'+ 195 "</tbody></table>"; 196 } 197 198 var handler_organizations = function(data){ 181 el.innerHTML = '<div style="width:645px; height:340px; margin: 2px !important; ">'+ 182 '<fieldset style="height:300px;">'+ 183 '<div style="width:500px; height:15px; font-size:8pt; color:red;">'+ 184 get_lang('Note: This sharing will take action on all of your folders and messages.')+ 185 '</div>'+ 186 '<br clear="all"/>'+ 187 '<div style="width:250px; height: 300px; position:aboslute; float:left;">'+ 188 '<label>'+get_lang('Organization')+'</label>'+ 189 '<br/>'+ 190 '<select id="em_combo_org" onchange="javascript:sharemailbox.get_available_users(this.value);"></select>'+ 191 '<br/><br/>'+ 192 '<label>'+get_lang('Search user')+'<span style="margin-left:10px; color:red;" id="em_span_searching"> </span><br></label>'+ 193 '<input id="em_input_searchUser" size="30" autocomplete="off" onkeyup="javascript:sharemailbox.optionFinderTimeout(this, event)">'+ 194 '<div style="margin-top:17px;"><label>'+get_lang('Users')+':</label></div>'+ 195 '<select id="em_select_available_users" style="width:250px; height:150px" multiple></select></td>'+ 196 '</div>'+ 197 '<div style="width:20px; height: 300px; position:relative; float:left;">'+ 198 '<div style="margin-top:120px;margin-left:3px;">'+ 199 '<img onClick="javascript:sharemailbox.add_user();" src="../phpgwapi/templates/azul/images/tabs-r0.gif" style="vertical-align:middle;cursor:pointer;">'+ 200 '<br/><br/>'+ 201 '<img onClick="javascript:sharemailbox.remove_user();" src="../phpgwapi/templates/azul/images/tabs-l0.gif" style="vertical-align:middle;cursor:pointer;">'+ 202 '</div>'+ 203 '</div>'+ 204 '<div style="width:348px; height:300px; position:relative; float:right;">'+ 205 '<div style="margin-top:90px;"><label>'+get_lang('Your mailbox is shared with')+' :</label></div>'+ 206 '<div style="position:absolute; float:left;">'+ 207 '<select onchange=sharemailbox.getaclfromuser(this.value); id="em_select_sharefolders_users" size="13" style="width:245px;height:150px">'+options+'</select>'+ 208 '</div>'+ 209 '<div style="position:relative; float:right; width:98px;">'+ 210 '<fieldset>'+ 211 '<legend>'+get_lang('Permission')+'</legend>'+ 212 '<div title="'+get_lang("hlp_msg_read_acl")+'" alt="'+get_lang("hlp_msg_read_acl")+'"><label style="padding-left:10px ;text-indent:-15px;"><input style="height:13px; padding:0; margin:0; vertical-align: bottom; position: relative;" id="em_input_readAcl" onClick="return sharemailbox.setaclfromuser();" type="checkbox">'+get_lang('Read')+'</label><div/>'+ 213 '<div title="'+get_lang("hlp_msg_delmov_acl")+'" alt="'+get_lang("hlp_msg_delmov_acl")+'"><label style="padding-left:10px ;text-indent:-15px;"><input style="height:13px; padding:0; margin:0; vertical-align: bottom; position: relative;" id="em_input_deleteAcl" onClick="return sharemailbox.setaclfromuser();" type="checkbox">'+get_lang('Exclusion')+'</label></div>'+ 214 '<div title="'+get_lang("hlp_msg_addcreate_acl")+'" alt="'+get_lang("hlp_msg_addcreate_acl")+'"><label style="padding-left:10px ;text-indent:-15px;"><input style="height:13px; padding:0; margin:0; vertical-align: bottom; position: relative;" id="em_input_writeAcl" onClick="return sharemailbox.setaclfromuser();" type="checkbox">'+get_lang('Write')+'</label></div>'+ 215 '<div title="'+get_lang("hlp_msg_sendlike_acl")+'" alt="'+get_lang("hlp_msg_sendlike_acl")+'"><label style="padding-left:10px ;text-indent:-15px;"><input style="height:13px; padding:0; margin:0; vertical-align: bottom; position: relative;" id="em_input_sendAcl" onClick="return sharemailbox.setaclfromuser();" type="checkbox">'+get_lang('Send')+'</label></div>'+ 216 '<div title="'+get_lang("hlp_msg_savelike_acl")+'" alt="'+get_lang("hlp_msg_savelike_acl")+'"><label style="padding-left:10px ;text-indent:-15px;"><input style="height:13px; padding:0; margin:0; vertical-align: bottom; position: relative;" id="em_input_saveAcl" onClick="return sharemailbox.setaclfromuser();" type="checkbox">'+get_lang('Save')+'</label></div>'+ 217 '</fieldset>'+ 218 '</div>'+ 219 '</div>'+ 220 '</fieldset>'+ 221 '</div>'; 222 } 223 224 var handler_organizations = function(data) 225 { 199 226 var user_organization = Element('user_organization').value; 200 227 201 for(i = 0; i < data.length; i++) { 228 for(i = 0; i < data.length; i++) 229 { 202 230 Element('em_combo_org').options[i] = new Option(data[i].ou,data[i].dn); 203 231 if(data[i].ou.indexOf("dc=") != -1 || user_organization.toUpperCase() == data[i].ou.toUpperCase()) … … 211 239 212 240 var butt = Element('dJSWin_wfolders_bok') 213 if (!butt){ 241 242 if ( !butt ) 243 { 214 244 butt = document.createElement('INPUT'); 245 butt.style.marginLeft = "5px"; 215 246 butt.id = 'dJSWin_wfolders_bok'; 216 247 butt.type = 'button'; … … 264 295 if(! this.arrayWin[div.id]) 265 296 { 266 div.style.height = " 480px";267 div.style.width = " 540px";297 div.style.height = "370px"; 298 div.style.width = "655px"; 268 299 var title = ":: "+get_lang("Mailbox Sharing")+" ::"; 269 300 var wHeight = div.offsetHeight + "px"; … … 294 325 } 295 326 296 var finderTimeout = ''; 297 cShareMailbox.prototype.optionFinderTimeout = function(obj) 298 { 299 clearTimeout(finderTimeout); 300 var oWait = document.getElementById("em_span_searching"); 301 oWait.innerHTML = get_lang('Searching')+"..."; 302 var finderTimeout = setTimeout("sharemailbox.optionFinder('"+obj.id+"')",500); 327 cShareMailbox.prototype.optionFinderTimeout = function(Obj, Event ) 328 { 329 var minNumChar = sharedFolders_min_num_characters; 330 var oWait = document.getElementById("em_span_searching"); 331 this.context = document.getElementById('em_combo_org').value; 332 333 if( ( parseInt(minNumChar) > 0 && minNumChar.toString() != "" ) && 334 sharedFolders_users_auto_search.toString() === "false" ) 335 { 336 var key = [8,27,37,38,39,40]; 337 var ev = Event; 338 var _inputSearch = Obj; 339 340 var cleanLabel = function(obj) 341 { 342 obj.innerHTML = ""; 343 } 344 345 var getUsers = function( _input, obj ) 346 { 347 var context = sharemailbox.context; 348 var cn = _input.value; 349 350 sharemailbox.get_available_users2( context, cn ); 351 352 cleanLabel(obj); 353 } 354 355 for( var i in key ) 356 { 357 if( ev.keyCode == key[i]) 358 { 359 return false; 360 } 361 } 362 363 if( _inputSearch.value.length < parseInt(minNumChar) ) 364 { 365 oWait.innerHTML = " ( Digite mais " + ( parseInt(minNumChar) - _inputSearch.value.length ) + " )"; 366 setTimeout(function(){cleanLabel(oWait);}, 2000); 367 } 368 else 369 { 370 oWait.innerHTML = " ( Buscando aguarde .... )"; 371 372 if( this.finderTimeout ) 373 clearTimeout(this.finderTimeout); 374 375 this.finderTimeout = setTimeout(function(){ getUsers( _inputSearch, oWait); }, 1000); 376 } 377 } 378 else 379 { 380 if( this.finderTimeout ) 381 clearTimeout(this.finderTimeout); 382 383 oWait.innerHTML = get_lang('Searching')+"..."; 384 385 this.finderTimeout = setTimeout(function(){ sharemailbox.optionFinder(Obj.id); }, 1000); 386 } 303 387 } 304 388 … … 327 411 } 328 412 } 329 oWait.innerHTML = ' '; 413 414 oWait.innerHTML = ''; 330 415 } 331 416 -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/setup/phpgw_pt-br.lang
r4248 r4644 1 % used expressoMail1_2 pt-br % utilizado1 f% used expressoMail1_2 pt-br % utilizado 2 2 View Quota Usage in Folders expressoMail1_2 pt-br Visualizar quota utilizada por cada pasta 3 3 You are currently using %1 (%2%). expressoMail1_2 pt-br Você está usando atualmente %1 (%2%). … … 373 373 People expressoMail1_2 pt-br Pessoas 374 374 Personal Catalog expressoMail1_2 pt-br Catálogo Pessoal 375 Permission expressoMail1_2 pt-br Permissões 375 376 Phone Warnings List expressoMail1_2 pt-br Lista de Alertas Telefônicos 376 377 Postfix with LDAP expressoMail1_2 pt-br Postfix with LDAP … … 463 464 Service unavailable expressoMail1_2 pt-br Serviço não disponível 464 465 Set Date expressoMail1_2 pt-br Informar data 466 Share folders admin pt-br Compartilhar Pastas 465 467 Shared folders expressoMail1_2 pt-br Pastas compartilhadas 466 468 Shared options saved with success expressoMail1_2 pt-br Opções de compartilhamento salvas com sucesso. … … 505 507 The field \"%1\" of the message it contains expressoMail1_2 pt-br O campo \"%1\" da mensagem contém 506 508 The folder %1 was successfully removed expressoMail1_2 pt-br A pasta %1 foi removida com sucesso! 509 The folders were fixed with success. expressoMail1_2 pt-br As pastas foram corrigidas com sucesso. 507 510 The folder was not deleted! expressoMail1_2 es-es A pasta não foi removida! 508 511 The import was executed successfully. expressoMail1_2 pt-br A importação foi executada com sucesso. … … 525 528 The size of this message has exceeded the limit (%1B). expressoMail1_2 pt-br O tamanho desta mensagem excedeu o limite (maior que %1B). 526 529 The Timezone you're in. expressoMail1_2 pt-br O fuso-horário em que você está. 530 There are folders with invalid format. If you want to fix now, click on button OK. expressoMail1_2 pt-br Algumas pastas possuem formato inválido.\n Para corrigi-las agora clique no botão 'OK'. 527 531 This is the number of messages shown in your mailbox per page expressoMail1_2 pt-br Este é o número de mensagens mostradas na sua caixa de correio por página 528 532 This list has no participants expressoMail1_2 pt-br Esta lista nao possui nenhum participante. … … 569 573 Voided message expressoMail1_2 pt-br Mensagem violada 570 574 Warning: Your Mailbox is almost full! expressoMail1_2 pt-br Aviso: Sua caixa postal está quase cheia! 575 Warning: The folders with invalid format will be unavailable. expressoMail1_2 pt-br Aviso: As pastas com formato inválido estarão indisponíveis. 571 576 was succefully removed expressoMail1_2 pt-br foi removida com sucesso 572 577 Wednesday expressoMail1_2 pt-br Quarta-feira -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/setup/setup.inc.php
r4350 r4644 12 12 $setup_info['expressoMail1_2']['name'] = 'expressoMail1_2'; 13 13 $setup_info['expressoMail1_2']['title'] = 'Expresso Mail'; 14 $setup_info['expressoMail1_2']['version'] = '2.2. 3';14 $setup_info['expressoMail1_2']['version'] = '2.2.4'; 15 15 $setup_info['expressoMail1_2']['app_order'] = 2; 16 16 $setup_info['expressoMail1_2']['tables'][] = 'phpgw_expressomail_contacts'; -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/setup/tables_update.inc.php
r4350 r4644 116 116 return $setup_info['expressoMail1_2']['currentver']; 117 117 } 118 $test[] = '2.2.3'; 119 function expressoMail1_2_upgrade2_2_3() { 120 $setup_info['expressoMail1_2']['currentver'] = '2.2.4'; 121 return $setup_info['expressoMail1_2']['currentver']; 122 } 118 123 ?> -
sandbox/expressoMail1_2/MailArchiver/2.2/expressoMail1_2/templates/default/config.tpl
r4023 r4644 121 121 </select> 122 122 </td> 123 </tr> 124 <tr bgcolor="{th_bg}"> 125 <td colspan="2"> 126 127 </td> 128 </tr> 129 <tr bgcolor="{row_on}"> 130 <td colspan="2"> 131 <label style="font-weight:bold;">{lang_Share_folders}</label> 132 </td> 133 </tr> 134 <tr bgcolor="{row_off}"> 135 <td>{lang_Do_you_wish_enable_autosearch?}</td> 136 <td> 137 <select id="usersAutoSearch" name="newsettings[expressoMail_users_auto_search]"> 138 <option value="true" {selected_expressoMail_users_auto_search_true}>{lang_Yes}</option> 139 <option value="false" {selected_expressoMail_users_auto_search_false}>{lang_No}</option> 140 </select> 141 </td> 142 </tr> 143 <tr bgcolor="{row_on}"> 144 <td>{lang_Minimum_number_of_characters_to_start_the_search_for_participants}</td> 145 <td> 146 <input type="text" id="minNum" value="{value_expressoMail_min_num_characters}" name="newsettings[expressoMail_min_num_characters]" size=2 maxlength=2 /> 147 </td> 123 148 </tr> 124 149 <!-- END body --> … … 126 151 <tr bgcolor="{th_bg}"> 127 152 <td colspan="2"> 128 153 129 154 </td> 130 155 </tr> -
sandbox/expressoMail1_2/MailArchiver/2.2/filemanager/templates/default/main.css
r4166 r4644 91 91 { 92 92 background-image: url(../../templates/default/images/dsused.gif); 93 width: 100%; 93 94 } 94 95 -
sandbox/expressoMail1_2/MailArchiver/2.2/help/setup/setup.inc.php
r4173 r4644 13 13 $setup_info['help']['name'] = 'help'; 14 14 $setup_info['help']['title'] = 'User Manual and Help Page'; 15 $setup_info['help']['version'] = '2.2. 1';15 $setup_info['help']['version'] = '2.2.2'; 16 16 $setup_info['help']['app_order'] = 5; 17 17 $setup_info['help']['enable'] = 2; // Invisible on top (navigation bar) -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/jmessenger/inc/jabberit_acl.inc.php
r4440 r4644 90 90 echo "<script type='text/javascript' src='".$webserver_url . "js/strophe.mini.js'></script>"; 91 91 echo "<script type='text/javascript' src='".$webserver_expresso . "js/browser/browserDetect.js'></script>"; 92 92 echo "<script type='text/javascript' src='".$webserver_url . "js/jscode/loadIM.mini.js'></script>"; 93 93 echo "<script type='text/javascript' src='".$webserver_url . "js/connector.mini.js'></script>"; 94 94 echo "<script type='text/javascript' src='".$webserver_expresso . "js/x_tools/xtools.js'></script>"; … … 98 98 echo "<script type='text/javascript' src='".$webserver_url . "js/show_hidden.mini.js'></script>"; 99 99 echo "<script type='text/javascript' src='".$webserver_url . "js/trophyim_constants.js'></script>"; 100 101 100 echo "<script type='text/javascript' src='".$webserver_url . "js/trophyim.mini.js'></script>"; 101 echo "<script type='text/javascript' src='".$webserver_url . "js/AddUser.mini.js'></script>"; 102 102 echo "<script type='text/javascript' src='".$webserver_url . "js/json2.js'></script>"; 103 103 echo "<script type='text/javascript' src='".$webserver_url . "js/SelectEditable.mini.js'></script>"; -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/jmessenger/js/jscode/loadIM.js
r4442 r4644 1 1 (function() 2 {3 4 5 6 7 8 2 { 3 var _autoStatus; 4 var _autoStatusTime = 60000; // 1 minuto 5 var addUser = null; 6 var conn = null; 7 var fullName = ""; 8 var path = ""; 9 9 var path_phpgwapi = ""; 10 var _preferencesIM = ""; 11 var selectEditable = null; 12 var showhidden = null; 13 var statusUserIM = ""; 14 var _statusMessage = ""; 15 var timeoutId = null; 16 var userCurrent = null; 17 var _timeOutNotification = ""; 18 var Xtools = null; 19 var zIndex = 9001; 20 var windowPopUp = []; 21 22 // Images 23 var add_user = new Image(); 24 add_user.src = path_jabberit + 'templates/default/images/adduser_azul.png'; 25 26 var arrow_down = new Image(); 27 arrow_down.src = path_jabberit + 'templates/default/images/arrow_down.gif'; 28 29 var arrow_right = new Image(); 30 arrow_right.src = path_jabberit + 'templates/default/images/arrow_right.gif'; 31 32 function actionButton() 33 { 34 if( arguments.length > 0 ) 35 { 36 var e = arguments[0]; 37 var _element = ( e.target ) ? e.target : e.srcElement; 38 var jid = arguments[1]; 39 var coord = null; 40 41 if ( !e ) 42 e = window.event; 43 44 var _X = e.clientX + document.body.scrollLeft - document.body.clientLeft; 45 var _Y = e.clientY + document.body.scrollTop - document.body.clientTop; 46 47 coord = { X : _X, Y : _Y }; 48 49 50 var _onContextMenu = function() 51 { 52 return false; 53 }; 54 55 window.document.oncontextmenu = _onContextMenu; 56 57 if( e.button ) 58 { 59 if( e.button > 1 ) 60 optionsItensContact( jid, coord ); 61 else 62 TrophyIM.rosterClick(jid); 63 } 64 else if( e.which ) 65 { 66 if( e.which > 1 ) 67 optionsItensContact( jid, coord ); 68 else 69 if( e.target.id ) 70 TrophyIM.rosterClick(jid); 71 } 72 73 setTimeout(function() 74 { 75 window.document.oncontextmenu = function() 76 { 77 return true; 78 }; 79 80 },500); 81 } 82 } 83 84 function addContact() 85 { 86 if( arguments.length > 0 ) 87 addUser.add(); 88 else 89 addUser.show(); 90 } 91 92 function addIcon() 93 { 94 95 var div_write_msg = ( getElement('em_div_write_msg') != null ) ? getElement('em_div_write_msg') : null ; 96 var StatusBar = ( getElement('divStatusBar') != null ) ? getElement('divStatusBar') : null ; 97 var StatusBarIM = ( getElement('JabberMessenger') != null ) ? getElement('JabberMessenger') : null; 98 99 /************************************************************************** 10 var _preferencesIM = ""; 11 var selectEditable = null; 12 var showhidden = null; 13 var statusUserIM = ""; 14 var _statusMessage = ""; 15 var timeoutId = null; 16 var userCurrent = null; 17 var _timeOutNotification = ""; 18 var Xtools = null; 19 var zIndex = 9001; 20 var windowPopUp = []; 21 22 // Images 23 var add_user = new Image(); 24 add_user.src = path_jabberit + 'templates/default/images/adduser_azul.png'; 25 26 var arrow_down = new Image(); 27 arrow_down.src = path_jabberit + 'templates/default/images/arrow_down.gif'; 28 29 var arrow_right = new Image(); 30 arrow_right.src = path_jabberit + 'templates/default/images/arrow_right.gif'; 31 32 function actionButton() 33 { 34 if( arguments.length > 0 ) 35 { 36 var e = arguments[0]; 37 var _element = ( e.target ) ? e.target : e.srcElement; 38 var jid = arguments[1]; 39 var coord = null; 40 41 if ( !e ) 42 e = window.event; 43 44 var _X = e.clientX + document.body.scrollLeft - document.body.clientLeft; 45 var _Y = e.clientY + document.body.scrollTop - document.body.clientTop; 46 47 coord = { 48 X : _X, 49 Y : _Y 50 }; 51 52 53 var _onContextMenu = function() 54 { 55 return false; 56 }; 57 58 window.document.oncontextmenu = _onContextMenu; 59 60 if( e.button ) 61 { 62 if( e.button > 1 ) 63 optionsItensContact( jid, coord ); 64 else 65 TrophyIM.rosterClick(jid); 66 } 67 else if( e.which ) 68 { 69 if( e.which > 1 ) 70 optionsItensContact( jid, coord ); 71 else 72 if( e.target.id ) 73 TrophyIM.rosterClick(jid); 74 } 75 76 setTimeout(function() 77 { 78 window.document.oncontextmenu = function() 79 { 80 return true; 81 }; 82 83 },500); 84 } 85 } 86 87 function addContact() 88 { 89 if( arguments.length > 0 ) 90 addUser.add(); 91 else 92 addUser.show(); 93 } 94 95 function addIcon() 96 { 97 98 var div_write_msg = ( getElement('em_div_write_msg') != null ) ? getElement('em_div_write_msg') : null ; 99 var StatusBar = ( getElement('divStatusBar') != null ) ? getElement('divStatusBar') : null ; 100 var StatusBarIM = ( getElement('JabberMessenger') != null ) ? getElement('JabberMessenger') : null; 101 102 /************************************************************************** 100 103 * 101 104 * Quando estiver habilitada a opção fora de escritório nos filtros. … … 103 106 */ 104 107 105 if( ( div_write_msg && StatusBarIM ) != null ) 106 { 107 div_write_msg.parentNode.insertBefore(StatusBarIM, div_write_msg); 108 StatusBarIM.style.paddingLeft = '33px'; 109 return; 110 } 111 112 /**************************************************************************/ 113 114 if ( !StatusBarIM ) 115 { 116 StatusBarIM = document.createElement('div'); 117 StatusBarIM.setAttribute('id', 'JabberMessenger'); 118 } 119 120 if( StatusBar ) 121 { 122 StatusBar.style.paddingLeft = '33px'; 123 124 var _div = document.createElement('div'); 125 _div.appendChild(StatusBar.parentNode.removeChild(StatusBar.previousSibling)); 126 127 StatusBar.parentNode.insertBefore( _div, StatusBar); 128 129 var _fastMenu = top.document.createElement('div'); 130 _fastMenu.setAttribute('id', 'fast_menu_jabber_expresso'); 131 _fastMenu.style.background = 'no-repeat'; 132 _fastMenu.style.backgroundImage = 'url(' + arrow_down.src + ')'; 133 _fastMenu.style.float = 'left'; 134 _fastMenu.style.height = '15px'; 135 _fastMenu.style.left = '7px'; 136 _fastMenu.style.margin = '8 0 0 10px'; 137 _fastMenu.style.padding = '0px'; 138 _fastMenu.style.position = 'absolute'; 139 _fastMenu.style.width = '15px'; 140 _fastMenu.style.cursor = 'pointer'; 141 142 StatusBarIM.insertBefore( _fastMenu, StatusBarIM.firstChild ); 143 144 // Add event onclick element _fastMenu 145 configEvents( _fastMenu, 'onclick', function(){ fastMenu(_fastMenu); }); 146 147 var _statusJabber = top.document.createElement('div'); 148 _statusJabber.setAttribute('id','status_jabber_expresso'); 149 _statusJabber.style.background = 'no-repeat'; 150 _statusJabber.style.backgroundImage = 'url(' + add_user.src +')'; 151 _statusJabber.style.float = 'left'; 152 _statusJabber.style.height = '18px'; 153 _statusJabber.style.left = '19px'; 154 _statusJabber.style.margin = '0 0 0 10px'; 155 _statusJabber.style.padding = '0px'; 156 _statusJabber.style.position = 'absolute'; 157 _statusJabber.style.width = '18px'; 158 _statusJabber.style.cursor = 'pointer'; 159 _statusJabber.style.zindex = '999999'; 160 161 StatusBarIM.insertBefore( _statusJabber, StatusBarIM.firstChild ); 162 163 StatusBar.insertBefore( StatusBarIM, StatusBar.firstChild ); 164 165 // Add event onclick element _statusJabber 166 if( _preferencesIM[0] == "openWindowJabberit:true" ) 167 { 168 configEvents( _statusJabber, 'onclick', function(){ rosterDiv(); }); 169 } 170 else 171 { 172 configEvents( _statusJabber, 'onclick', function(){ TrophyIM.load(); }); 173 } 174 } 175 } 176 177 function addNewUser() 178 { 179 addUser.newUser(); 180 } 181 182 function autoStatus() 183 { 184 var _div_status = ( getElement('status_jabber_expresso') != null ) ? getElement('status_jabber_expresso') : null; 185 186 if ( _autoStatus ) 187 clearTimeout(_autoStatus); 188 189 if ( _div_status != null ) 190 { 191 var _status = _div_status.style.backgroundImage; 192 _status = _status.substr(_status.lastIndexOf('/') + 1); 193 _status = _status.substr(0, _status.indexOf('.')); 194 195 if( _status == "xa" && _div_status.getAttribute('autoStatus') ) 196 { 197 if( getStatusMessage() != "") 198 TrophyIM.setPresence("available", getStatusMessage()); 199 else 200 TrophyIM.setPresence("available"); 201 202 _div_status.removeAttribute('autoStatus'); 203 loadscript.setStatusJabber("Disponível","available"); 204 } 205 } 206 207 var TimeStatus = _preferencesIM[2].split(':'); 208 209 if( TimeStatus[1] ) 210 _autoStatus = setTimeout( function(){ autoStatusHandler();}, parseInt(TimeStatus[1]) * _autoStatusTime ); 211 else 212 _autoStatus = setTimeout( function(){ autoStatusHandler();}, parseInt(_autoStatusTime)); 213 } 214 215 function autoStatusHandler() 216 { 217 var _div_status = ( getElement('status_jabber_expresso') != null ) ? getElement('status_jabber_expresso') : null; 218 219 if ( _div_status != null ) 220 { 221 var _status = _div_status.style.backgroundImage; 222 _status = _status.substr(_status.lastIndexOf('/') + 1); 223 _status = _status.substr(0, _status.indexOf('.')); 224 225 if( _status == "available" ) 226 { 227 if(getStatusMessage() != "") 228 TrophyIM.setPresence("xa", getStatusMessage()); 229 else 230 TrophyIM.setPresence("xa"); 231 232 _div_status.setAttribute('autoStatus','true'); 233 234 loadscript.setStatusJabber("Não Disponível","xa"); 235 } 236 } 237 } 238 239 function clrAllContacts() 240 { 241 getElement("JabberIMRoster").innerHTML = ""; 242 } 243 244 function configEvents(pObj, pEvent, pHandler) 245 { 246 if ( typeof pObj == 'object' ) 247 { 248 if ( pEvent.substring(0, 2) == 'on' ) 249 pEvent = pEvent.substring(2, pEvent.length ); 250 251 if ( arguments.length == 3 ) 252 { 253 if ( pObj.addEventListener ) 254 pObj.addEventListener(pEvent, pHandler, false ); 255 else if ( pObj.attachEvent ) 256 pObj.attachEvent( 'on' + pEvent, pHandler ); 257 } 258 else if ( arguments.length == 4 ) 259 { 260 if ( pObj.removeEventListener ) 261 pObj.removeEventListener( pEvent, pHandler, false ); 262 else if ( pObj.detachEvent ) 263 pObj.detachEvent( 'on' + pEvent, pHandler ); 264 } 265 } 266 } 267 268 function disabledNotificationNewUsers() 269 { 270 var _notification = getElement('notification_new_users_jabber') ; 271 var _statusJabber = getElement('status_jabber_expresso'); 272 273 _notification.style.display = 'none'; 274 275 _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat"; 276 277 if( _timeOutNotification ) 278 clearTimeout(_timeOutNotification ); 279 280 TrophyIM.controll.notificationNewUsers = 0; 281 } 282 283 function enabledNotificationNewUsers() 284 { 285 var _notification = getElement('notification_new_users_jabber') ; 286 var _statusJabber = getElement('status_jabber_expresso'); 287 288 if( _notification && _statusJabber ) 289 { 290 if ( _notification.style.display == 'none' ) 291 { 292 _notification.style.display = 'block'; 293 294 _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/alert_mini.png') no-repeat"; 295 296 if( _timeOutNotification ) 297 clearTimeout(_timeOutNotification ); 298 299 _timeOutNotification = setTimeout( function(){ enabledNotificationNewUsers(); }, 2000 ); 300 } 301 else 302 { 303 _notification.style.display = 'none'; 304 305 _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat"; 306 307 if( _timeOutNotification ) 308 clearTimeout(_timeOutNotification ); 309 310 _timeOutNotification = setTimeout( function(){ enabledNotificationNewUsers(); }, 800 ); 311 } 312 } 313 } 314 315 function fastMenu() 316 { 317 if( arguments.length > 0 ) 318 { 319 var element = arguments[0]; 320 321 if( showhidden == null ) 322 showhidden = new ShowHidden(300); 323 324 var _options = [ 325 ['Adicionar Contato', 'loadscript.addContact();' ], 326 ['Preferências', 'loadscript.preferences();'] 327 ]; 328 329 if( im_chatroom == "false" ) 330 { 331 _options[2] = [ 'Sala(s) de Bate-Papo','loadscript.getListRooms();']; 332 } 333 334 var _itens = ""; 335 336 for( var i in _options ) 337 { 338 if( _options[i].constructor == Function ) 339 continue; 340 341 _itens += '<img src="'+arrow_right.src+'"/>'; 342 _itens += '<span style="cursor:pointer; margin:3px;" onclick='+_options[i][1]+'>'; 343 _itens += _options[i][0] + '</span><br/>'; 344 } 345 346 var _optionsItens = document.createElement("div"); 347 _optionsItens.id = "fastMenu_Jabber"; 348 _optionsItens.style.marginTop = "19px"; 349 _optionsItens.style.marginLeft = "-8px"; 350 _optionsItens.className = "x-menu"; 351 _optionsItens.style.zIndex = '999999'; 352 _optionsItens.innerHTML = _itens; 353 _optionsItens.onclick = function(){ showhidden.hiddenObject(false); }; 354 _optionsItens.onmouseout = function(){ showhidden.hiddenObject(false); }; 355 _optionsItens.onmouseover = function(){ showhidden.hiddenObject(true); }; 108 if( ( div_write_msg && StatusBarIM ) != null ) 109 { 110 div_write_msg.parentNode.insertBefore(StatusBarIM, div_write_msg); 111 StatusBarIM.style.paddingLeft = '33px'; 112 return; 113 } 114 115 /**************************************************************************/ 116 117 if ( !StatusBarIM ) 118 { 119 StatusBarIM = document.createElement('div'); 120 StatusBarIM.setAttribute('id', 'JabberMessenger'); 121 } 122 123 if( StatusBar ) 124 { 125 StatusBar.style.paddingLeft = '33px'; 126 127 var _div = document.createElement('div'); 128 _div.appendChild(StatusBar.parentNode.removeChild(StatusBar.previousSibling)); 129 130 StatusBar.parentNode.insertBefore( _div, StatusBar); 131 132 var _fastMenu = top.document.createElement('div'); 133 _fastMenu.setAttribute('id', 'fast_menu_jabber_expresso'); 134 _fastMenu.style.background = 'no-repeat'; 135 _fastMenu.style.backgroundImage = 'url(' + arrow_down.src + ')'; 136 _fastMenu.style.float = 'left'; 137 _fastMenu.style.height = '15px'; 138 _fastMenu.style.left = '7px'; 139 _fastMenu.style.margin = '8 0 0 10px'; 140 _fastMenu.style.padding = '0px'; 141 _fastMenu.style.position = 'absolute'; 142 _fastMenu.style.width = '15px'; 143 _fastMenu.style.cursor = 'pointer'; 144 145 StatusBarIM.insertBefore( _fastMenu, StatusBarIM.firstChild ); 146 147 // Add event onclick element _fastMenu 148 configEvents( _fastMenu, 'onclick', function(){ 149 fastMenu(_fastMenu); 150 }); 151 152 var _statusJabber = top.document.createElement('div'); 153 _statusJabber.setAttribute('id','status_jabber_expresso'); 154 _statusJabber.style.background = 'no-repeat'; 155 _statusJabber.style.backgroundImage = 'url(' + add_user.src +')'; 156 _statusJabber.style.float = 'left'; 157 _statusJabber.style.height = '18px'; 158 _statusJabber.style.left = '19px'; 159 _statusJabber.style.margin = '0 0 0 10px'; 160 _statusJabber.style.padding = '0px'; 161 _statusJabber.style.position = 'absolute'; 162 _statusJabber.style.width = '18px'; 163 _statusJabber.style.cursor = 'pointer'; 164 _statusJabber.style.zindex = '999999'; 165 166 StatusBarIM.insertBefore( _statusJabber, StatusBarIM.firstChild ); 167 168 StatusBar.insertBefore( StatusBarIM, StatusBar.firstChild ); 169 170 // Add event onclick element _statusJabber 171 if( _preferencesIM[0] == "openWindowJabberit:true" ) 172 { 173 configEvents( _statusJabber, 'onclick', function(){ 174 rosterDiv(); 175 }); 176 } 177 else 178 { 179 configEvents( _statusJabber, 'onclick', function(){ 180 TrophyIM.load(); 181 }); 182 } 183 } 184 } 185 186 function addNewUser() 187 { 188 addUser.newUser(); 189 } 190 191 function autoStatus() 192 { 193 var _div_status = ( getElement('status_jabber_expresso') != null ) ? getElement('status_jabber_expresso') : null; 194 195 if ( _autoStatus ) 196 clearTimeout(_autoStatus); 197 198 if ( _div_status != null ) 199 { 200 var _status = _div_status.style.backgroundImage; 201 _status = _status.substr(_status.lastIndexOf('/') + 1); 202 _status = _status.substr(0, _status.indexOf('.')); 203 204 if( _status == "xa" && _div_status.getAttribute('autoStatus') ) 205 { 206 if( getStatusMessage() != "") 207 TrophyIM.setPresence("available", getStatusMessage()); 208 else 209 TrophyIM.setPresence("available"); 210 211 _div_status.removeAttribute('autoStatus'); 212 loadscript.setStatusJabber("Disponível","available"); 213 } 214 } 215 216 var TimeStatus = _preferencesIM[2].split(':'); 217 218 if( TimeStatus[1] ) 219 _autoStatus = setTimeout( function(){ 220 autoStatusHandler(); 221 }, parseInt(TimeStatus[1]) * _autoStatusTime ); 222 else 223 _autoStatus = setTimeout( function(){ 224 autoStatusHandler(); 225 }, parseInt(_autoStatusTime)); 226 } 227 228 function autoStatusHandler() 229 { 230 var _div_status = ( getElement('status_jabber_expresso') != null ) ? getElement('status_jabber_expresso') : null; 231 232 if ( _div_status != null ) 233 { 234 var _status = _div_status.style.backgroundImage; 235 _status = _status.substr(_status.lastIndexOf('/') + 1); 236 _status = _status.substr(0, _status.indexOf('.')); 237 238 if( _status == "available" ) 239 { 240 if(getStatusMessage() != "") 241 TrophyIM.setPresence("xa", getStatusMessage()); 242 else 243 TrophyIM.setPresence("xa"); 244 245 _div_status.setAttribute('autoStatus','true'); 246 247 loadscript.setStatusJabber("Não Disponível","xa"); 248 } 249 } 250 } 251 252 function clrAllContacts() 253 { 254 getElement("JabberIMRoster").innerHTML = ""; 255 } 256 257 function configEvents(pObj, pEvent, pHandler) 258 { 259 if ( typeof pObj == 'object' ) 260 { 261 if ( pEvent.substring(0, 2) == 'on' ) 262 pEvent = pEvent.substring(2, pEvent.length ); 263 264 if ( arguments.length == 3 ) 265 { 266 if ( pObj.addEventListener ) 267 pObj.addEventListener(pEvent, pHandler, false ); 268 else if ( pObj.attachEvent ) 269 pObj.attachEvent( 'on' + pEvent, pHandler ); 270 } 271 else if ( arguments.length == 4 ) 272 { 273 if ( pObj.removeEventListener ) 274 pObj.removeEventListener( pEvent, pHandler, false ); 275 else if ( pObj.detachEvent ) 276 pObj.detachEvent( 'on' + pEvent, pHandler ); 277 } 278 } 279 } 280 281 function disabledNotificationNewUsers() 282 { 283 var _notification = getElement('notification_new_users_jabber') ; 284 var _statusJabber = getElement('status_jabber_expresso'); 285 286 _notification.style.display = 'none'; 287 288 _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat"; 289 290 if( _timeOutNotification ) 291 clearTimeout(_timeOutNotification ); 292 293 TrophyIM.controll.notificationNewUsers = 0; 294 } 295 296 function enabledNotificationNewUsers() 297 { 298 var _notification = getElement('notification_new_users_jabber') ; 299 var _statusJabber = getElement('status_jabber_expresso'); 300 301 if( _notification && _statusJabber ) 302 { 303 if ( _notification.style.display == 'none' ) 304 { 305 _notification.style.display = 'block'; 306 307 _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/alert_mini.png') no-repeat"; 308 309 if( _timeOutNotification ) 310 clearTimeout(_timeOutNotification ); 311 312 _timeOutNotification = setTimeout( function(){ 313 enabledNotificationNewUsers(); 314 }, 2000 ); 315 } 316 else 317 { 318 _notification.style.display = 'none'; 319 320 _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat"; 321 322 if( _timeOutNotification ) 323 clearTimeout(_timeOutNotification ); 324 325 _timeOutNotification = setTimeout( function(){ 326 enabledNotificationNewUsers(); 327 }, 800 ); 328 } 329 } 330 } 331 332 function fastMenu() 333 { 334 if( arguments.length > 0 ) 335 { 336 var element = arguments[0]; 337 338 if( showhidden == null ) 339 showhidden = new ShowHidden(300); 340 341 var _options = [ 342 ['Adicionar Contato', 'loadscript.addContact();' ], 343 ['Preferências', 'loadscript.preferences();'] 344 ]; 345 346 if( im_chatroom == "false" ) 347 { 348 _options[2] = [ 'Sala(s) de Bate-Papo','loadscript.getListRooms();']; 349 } 350 351 var _itens = ""; 352 353 for( var i in _options ) 354 { 355 if( _options[i].constructor == Function ) 356 continue; 357 358 _itens += '<img src="'+arrow_right.src+'"/>'; 359 _itens += '<span style="cursor:pointer; margin:3px;" onclick='+_options[i][1]+'>'; 360 _itens += _options[i][0] + '</span><br/>'; 361 } 362 363 var _optionsItens = document.createElement("div"); 364 _optionsItens.id = "fastMenu_Jabber"; 365 _optionsItens.style.marginTop = "19px"; 366 _optionsItens.style.marginLeft = "-8px"; 367 _optionsItens.className = "x-menu"; 368 _optionsItens.style.zIndex = '999999'; 369 _optionsItens.innerHTML = _itens; 370 _optionsItens.onclick = function(){ 371 showhidden.hiddenObject(false); 372 }; 373 _optionsItens.onmouseout = function(){ 374 showhidden.hiddenObject(false); 375 }; 376 _optionsItens.onmouseover = function(){ 377 showhidden.hiddenObject(true); 378 }; 356 379 357 358 359 360 361 362 363 364 365 366 367 368 function getIsIE()369 370 return SnifferBrowser.isCompatible('is_ie');371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 380 showhidden.action('onmouseover', 'onmouseout', _optionsItens); 381 382 element.parentNode.appendChild( _optionsItens ); 383 } 384 } 385 386 function getElement( elementId ) 387 { 388 return document.getElementById( elementId ); 389 } 390 391 function getBrowserCompatible() 392 { 393 return SnifferBrowser.isCompatible('firefox3','firefox4','firefox5'); 394 } 395 396 function getPhotoUser( jid ) 397 { 398 try 399 { 400 var _divPhoto = getElement( jid + '__photo' ); 401 402 if( _divPhoto.style.backgroundImage.indexOf('photo.png') > 0 ) 403 { 404 var _imgUser = path_jabberit + 'inc/WebService.php?' + Date.parse( new Date ); 405 _imgUser += '&photo_ldap=' + jid; 406 407 _divPhoto.style.backgroundImage = 'url(' + _imgUser + ')'; 408 } 409 }catch(e){} 410 } 411 412 function getShowContactsOffline() 413 { 414 if( _preferencesIM[3] ) 415 { 416 var showOffline = _preferencesIM[3].split(":"); 417 418 if( showOffline[1] === "true") 419 return true; 420 else 421 return false; 422 } 423 424 return true; 425 } 426 427 function getSmiles( String ) 428 { 429 String = String.replace( /:\)|:-\)/g , " <img src='"+path_jabberit+"templates/default/images/smiles/1.gif'/> "); 430 String = String.replace( /:-D/g , " <img src='"+path_jabberit+"templates/default/images/smiles/2.gif'/> "); 431 String = String.replace( /;-\)/g , " <img src='"+path_jabberit+"templates/default/images/smiles/3.gif'/> "); 432 String = String.replace( /=-O/g , " <img src='"+path_jabberit+"templates/default/images/smiles/4.gif'/> "); 433 String = String.replace( /:P/g , " <img src='"+path_jabberit+"templates/default/images/smiles/5.gif'/> "); 434 String = String.replace( /8-\)/g , " <img src='"+path_jabberit+"templates/default/images/smiles/6.gif'/> "); 435 String = String.replace( /\>:o/g , " <img src='"+path_jabberit+"templates/default/images/smiles/7.gif'/> "); 436 String = String.replace( /:-\$/g , " <img src='"+path_jabberit+"templates/default/images/smiles/8.gif'/> "); 437 String = String.replace( /:s|:-X/g , " <img src='"+path_jabberit+"templates/default/images/smiles/9.gif'/> "); 438 String = String.replace( /:-\(/g , " <img src='"+path_jabberit+"templates/default/images/smiles/10.gif'/> "); 439 String = String.replace( /:\'\(/g , " <img src='"+path_jabberit+"templates/default/images/smiles/11.gif'/> "); 440 String = String.replace( /:\|/g , " <img src='"+path_jabberit+"templates/default/images/smiles/12.gif'/> "); 441 String = String.replace( /O:-\)/g , " <img src='"+path_jabberit+"templates/default/images/smiles/13.gif'/> "); 442 String = String.replace( /\*\*@#%/g , " <img src='"+path_jabberit+"templates/default/images/smiles/14.gif'/> "); 443 String = String.replace( /\(I\)/g , " <img src='"+path_jabberit+"templates/default/images/smiles/15.gif'/> "); 444 String = String.replace( /C28I/g , " <img src='"+path_jabberit+"templates/default/images/smiles/16.gif'/> "); 445 String = String.replace( /CS2A/g , " <img src='"+path_jabberit+"templates/default/images/smiles/17.gif' style='width:42px;height:36px;'/> "); 446 String = String.replace( /\(CzzzzI\)/g , " <img src='"+path_jabberit+"templates/default/images/smiles/18.gif'/> "); 424 447 425 return String; 426 } 427 428 function getStatusUserIM() 429 { 430 return statusUserIM; 431 } 432 433 function getStatusMessage() 434 { 435 return _statusMessage; 436 } 437 438 function getUserCurrent() 439 { 440 return userCurrent; 441 } 442 443 function getZindex() 444 { 445 return zIndex++; 446 } 447 448 function groupsHidden() 449 { 450 if( arguments.length > 0 ) 451 { 452 var _element = arguments[0]; 453 _element.style.background = "url('"+path_jabberit+"templates/default/images/arrow_right.gif') no-repeat center left"; 454 _element.onclick = function(){ groupsVisible(_element);}; 455 456 // Hidden all 457 var _elementNext = _element.nextSibling; 458 459 while( _elementNext ) 460 { 461 if( _elementNext.nodeType == 1 ) 462 _elementNext.style.display = "none"; 448 return String; 449 } 450 451 function getStatusUserIM() 452 { 453 return statusUserIM; 454 } 455 456 function getStatusMessage() 457 { 458 return _statusMessage; 459 } 460 461 function getUserCurrent() 462 { 463 return userCurrent; 464 } 465 466 function getZindex() 467 { 468 return zIndex++; 469 } 470 471 function groupsHidden() 472 { 473 if( arguments.length > 0 ) 474 { 475 var _element = arguments[0]; 476 _element.style.background = "url('"+path_jabberit+"templates/default/images/arrow_right.gif') no-repeat center left"; 477 _element.onclick = function(){ 478 groupsVisible(_element); 479 }; 480 481 // Hidden all 482 var _elementNext = _element.nextSibling; 483 484 while( _elementNext ) 485 { 486 if( _elementNext.nodeType == 1 ) 487 _elementNext.style.display = "none"; 463 488 464 _elementNext = _elementNext.nextSibling; 465 } 466 } 467 } 468 469 function groupsVisible() 470 { 471 if( arguments.length > 0 ) 472 { 473 var _element = arguments[0]; 474 _element.style.background = "url('"+path_jabberit+"templates/default/images/arrow_down.gif') no-repeat center left"; 475 _element.onclick = function(){ groupsHidden(_element);}; 476 477 // Display all 478 var _elementNext = _element.nextSibling; 479 480 while( _elementNext ) 481 { 482 if( _elementNext.nodeType == 1 && _elementNext.nodeName.toLowerCase() == "div" ) 483 { 484 var is_off = _elementNext.style.backgroundImage.indexOf("unavailable"); 485 486 if( is_off > 0 && !getShowContactsOffline()) 487 { 488 _elementNext.style.display = "none"; 489 getElement("span_show_" + _elementNext.id ).style.display = "none"; 489 _elementNext = _elementNext.nextSibling; 490 } 491 } 492 } 493 494 function groupsVisible() 495 { 496 if( arguments.length > 0 ) 497 { 498 var _element = arguments[0]; 499 _element.style.background = "url('"+path_jabberit+"templates/default/images/arrow_down.gif') no-repeat center left"; 500 _element.onclick = function(){ 501 groupsHidden(_element); 502 }; 503 504 // Display all 505 var _elementNext = _element.nextSibling; 506 507 while( _elementNext ) 508 { 509 if( _elementNext.nodeType == 1 && _elementNext.nodeName.toLowerCase() == "div" ) 510 { 511 var is_off = _elementNext.style.backgroundImage.indexOf("unavailable"); 512 513 if( is_off > 0 && !getShowContactsOffline()) 514 { 515 _elementNext.style.display = "none"; 516 getElement("span_show_" + _elementNext.id ).style.display = "none"; 490 517 491 } 492 else 493 { 494 _elementNext.style.display = "block"; 495 getElement("span_show_" + _elementNext.id ).style.display = "block"; 496 } 497 } 498 499 _elementNext = _elementNext.nextSibling; 500 } 501 } 502 } 503 504 function keyPressSearch() 505 { 506 if( arguments.length > 0 ) 507 { 508 var ev = arguments[0]; 509 var element = arguments[1]; 510 511 if ( ev.keyCode == 13 ) 512 if( element.value.length >= 3 ) 513 searchUser( element.value ); 514 else 515 alert( i18n.YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS + '.' ); 516 } 517 } 518 519 520 function loginPage() 521 { 522 var paramsLoginPage = 523 { 524 'username' : ((( Base64.decode(getUserCurrent().jid) )) ? Base64.decode(getUserCurrent().jid) : ""), 525 'password' : ((( Base64.decode(getUserCurrent().password) )) ? Base64.decode(getUserCurrent().password) : "") 526 } 527 528 var winLoginPage = 529 { 530 id_window : "window_login_page", 531 width : 260, 532 height : 120, 533 top : 100, 534 left : 400, 535 draggable : true, 536 visible : "display", 537 resizable : true, 538 zindex : zIndex++, 539 title : "Expresso Messenger - Login", 540 closeAction : "remove", 541 content : Xtools.parse(Xtools.xml("login_page"), "loginPage.xsl", paramsLoginPage) 542 }; 543 544 _winBuild( winLoginPage ); 545 } 546 547 function loadScripts(pFiles) 548 { 549 // Load JavaScript 550 var loadJavaScript = function(pJs) 551 { 552 var newScript = document.createElement("script"); 553 newScript.setAttribute("type", "text/javascript"); 554 newScript.setAttribute("src", pJs ); 555 556 return newScript; 557 }; 558 559 // Load CSS 560 var loadStyleSheet = function(pCss) 561 { 562 var newStyle = document.createElement("link"); 563 newStyle.setAttribute("rel", "stylesheet"); 564 newStyle.setAttribute("type", "text/css"); 565 newStyle.setAttribute("href", pCss); 566 567 return newStyle; 568 }; 569 570 for(var i = 0; i < pFiles.length; i++) 571 { 572 if( pFiles[i].indexOf(".js") > -1 ) 573 document.getElementsByTagName("head")[0].appendChild(loadJavaScript(pFiles[i])); 574 575 if( pFiles[i].indexOf(".css") > -1 ) 576 document.getElementsByTagName("head")[0].appendChild(loadStyleSheet(pFiles[i])); 577 } 578 } 579 580 function notificationNewMessage() 581 { 582 var _doc = document; 583 var _id = arguments[0]; 584 var _win_name = _id.replace( /\W/g, '' ); 585 586 if ( windowPOPUP( _id ) ) 587 { 588 _doc = windowPopUp[_win_name].document; 589 } 590 591 var oldTitle = _doc.title; 592 var newTitle = "## NOVA MENSAGEM ##"; 593 594 if( timeoutId == null ) 595 { 596 timeoutId = setInterval(function() 597 { 598 _doc.title = ( _doc.title == newTitle ) ? oldTitle : newTitle; 599 }, 1000); 600 601 configEvents( _doc, 'onclick', function() 602 { 603 clearInterval(timeoutId); 604 _doc.title = oldTitle; 605 timeoutId = null; 606 }); 607 608 configEvents( _doc, 'onkeypress', function() 609 { 610 clearInterval(timeoutId); 611 _doc.title = oldTitle; 612 timeoutId = null; 613 }); 614 } 615 } 616 617 function optionsItensContact() 618 { 619 if( arguments.length > 0 ) 620 { 621 var jid = arguments[0]; 622 var coord = arguments[1]; 623 var element = getElement('itenContact_' + jid ); 624 var action = ( element.getAttribute("subscription") === "not-in-roster" ) ? "Adicionar" : "Autorizar"; 625 626 if( showhidden == null ) 627 showhidden = new ShowHidden(300); 628 629 var _options = [ 630 [ action , 'loadscript.setAutorization(\''+jid+'\')'], 631 ['Remover' , 'loadscript.removeContact(\''+jid+'\')'], 632 ['Renomear' , 'loadscript.renameContact(\''+jid+'\')'], 633 ['Trocar grupo' , 'loadscript.renameGroup(\''+jid+'\')'] 634 ]; 635 636 var _itens = ""; 637 638 for( var i in _options ) 639 { 640 if( typeof(_options[i]) == "object") 641 { 642 _itens += '<img src="'+arrow_right.src+'"/>'; 643 _itens += '<span style="cursor:pointer;margin:3px;font-weight:normal;" onclick='+_options[i][1]+'>'; 644 _itens += _options[i][0] + '</span><br/>'; 645 } 646 } 647 648 var _optionsItens = document.createElement("div"); 649 _optionsItens.className = "x-menu"; 650 _optionsItens.style.top = coord.Y; 651 _optionsItens.style.left = ( coord.X - element.offsetLeft ); 652 _optionsItens.style.zIndex = getZindex(); 653 _optionsItens.innerHTML = _itens; 654 _optionsItens.onclick = function(){ showhidden.hiddenObject(false); }; 655 _optionsItens.onmouseout = function(){ showhidden.hiddenObject(false); }; 656 _optionsItens.onmouseover = function(){ showhidden.hiddenObject(true); }; 657 658 showhidden.action('onmouseover', 'onmouseout', _optionsItens); 659 660 window.document.body.appendChild(_optionsItens); 661 } 662 } 663 664 function parse() 665 { 666 if( arguments.length == 2 ) 667 return Xtools.parse(Xtools.xml(arguments[0]), arguments[1] ); 668 669 if( arguments.length === 3 ) 670 return Xtools.parse(Xtools.xml(arguments[0]), arguments[1], arguments[2] ); 671 } 672 673 function preferences() 674 { 675 var paramPreferences = 676 { 677 'path' : path, 678 'lang1' : 'Suas Preferências', 679 'lang2' : 'Conexão', 680 'lang3' : 'Conectar Automaticamente o IM', 681 'lang4' : 'Usuários OffLine', 682 'lang5' : 'Exibir amigos Offline', 683 'lang6' : 'Salvar', 684 'lang7' : 'Cancelar', 685 'lang8' : 'Janela de Contatos', 686 'lang9' : 'Abrir janela como Pop-up', 687 'lang10' : 'Ausente', 688 'lang11' : 'Definir status de ausente depois de', 689 'lang12' : 'minutos', 690 'lang13' : 'Mostrar Contatos', 691 'lang14' : 'Mostrar contatos desconectados', 692 'langYes': 'Sim', 693 'langNo' : 'Não' 694 }; 695 696 697 var _win_preferences = 698 { 699 id_window : "jabberit_preferences", 700 width : 430, 701 height : 350, 702 top : 150, 703 left : 100, 704 draggable : true, 705 visible : "display", 706 resizable : true, 707 zindex : zIndex++, 708 title : 'Expresso Messenger - Preferências', 709 closeAction : "remove", 710 content : Xtools.parse(Xtools.xml('preferences'), 'preferences.xsl', paramPreferences) 711 }; 712 713 _winBuild(_win_preferences); 714 715 716 var _pButtons = { 717 'lang1' : 'Salvar', 718 'lang2' : 'Fechar', 719 'onclickClose' : '_winBuild("jabberit_preferences","remove");', 720 'onclickSubmit' : 'javascript:loadscript.setPreferences();' 721 }; 722 723 document.getElementById('buttons_preferences_jabberit').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons); 724 725 // Element openWindowJabberit 726 var value1 = _preferencesIM[0].split(':'); 727 var element1 = document.getElementById(value1[0]); 728 var valueSelect1 = value1[1]; 729 730 for(var i = 0; i < element1.options.length; i++) 731 if( element1.options[i].value == valueSelect1 ) 732 element1.options[i].selected = true; 733 734 // Element openWindowJabberitPopUp 735 var value2 = _preferencesIM[1].split(':'); 736 737 // Element flagAwayIM 738 var value3 = _preferencesIM[2].split(':'); 739 var element3 = document.getElementById(value3[0]); 740 element3.value = value3[1]; 741 742 // Element showContactsOfflineJabberit 743 var value4 = _preferencesIM[3].split(':'); 744 var element4 = document.getElementById(value4[0]); 745 var valueSelect4 = value4[1]; 746 for(var i = 0; i < element4.options.length; i++) 747 if( element4.options[i].value == valueSelect4 ) 748 element4.options[i].selected = true; 749 } 750 751 function removeContact( jid ) 752 { 753 TrophyIM.removeContact( jid ); 754 } 755 756 function removeElement( ) 757 { 758 if( arguments.length > 0 ) 759 { 760 var _element = arguments[0] 761 762 if( _element != null ) 763 { 764 _element.parentNode.removeChild( _element ); 765 } 766 } 767 } 768 769 function removeGroup() 770 { 771 var _parent = arguments[0]; 772 773 if( _parent.childNodes.length <= 2 ) 774 _parent.parentNode.removeChild(_parent); 775 } 776 777 function renameContact() 778 { 779 if( arguments.length > 0 ) 780 { 781 var _jid = arguments[0]; 782 783 TrophyIM.renameContact( _jid ); 784 } 785 } 786 787 function renameGroup() 788 { 789 if( arguments.length > 0 ) 790 { 791 var _jid = arguments[0]; 792 793 TrophyIM.renameGroup( _jid ); 794 } 795 } 796 797 function rosterDiv() 798 { 799 var _rosterDiv = function() 800 { 801 802 var winRosterDiv = 803 { 804 id_window : "window_Roster_im", 805 width : 250, 806 height : 410, 807 top : 50, 808 left : -1500, 809 leftOld : 50, 810 draggable : true, 811 visible : "display", 812 resizable : true, 813 zindex : zIndex++, 814 title : "Expresso Messenger - Contatos", 815 closeAction : "hidden", 816 content : "" 817 }; 818 819 if( _preferencesIM[0] == "openWindowJabberit:false" ) 820 { 821 winRosterDiv.left = 50; 822 winRosterDiv.leftOld = -1500; 823 } 824 825 if( SnifferBrowser.isCompatible('ie8','firefox3','firefox4','epiphany2','iceweasel3') ) 826 { 827 var _idUser = Base64.decode(getUserCurrent().jid); 828 829 var paramListContact = 830 { 831 'idUser' : _idUser, 832 'full_name' : (( fullName.length < 25 ) ? fullName : ( fullName.substring( 0, 25) + "...")), 833 'path_jabberit' : path_jabberit, 834 'help_expresso' : help_expresso, 835 'zIndex_' : zIndex++ 836 }; 837 838 winRosterDiv.content = Xtools.parse(Xtools.xml("contacts_list"),"contactsList.xsl", paramListContact) 839 840 } 841 else 842 { 843 var paramList = 844 { 845 'path' : path_phpgwapi 846 }; 847 848 winRosterDiv.width = 280; 849 winRosterDiv.height = 430; 850 winRosterDiv.content = Xtools.parse( Xtools.xml("navigator"), path_phpgwapi + "templates/default/xsl/navigatorCompatible.xsl" , paramList); 851 } 852 853 _winBuild( winRosterDiv ); 854 855 // Photo User 856 getPhotoUser(_idUser); 857 } 858 859 setTimeout( function(){ _rosterDiv(); }, 200 ); 860 } 861 862 function searchUser() 863 { 864 var _input = getElement('search_user_jabber'); 865 866 if( _input.value.length >= 3 ) 867 addUser.search(); 868 else 869 alert( i18n.YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS + '.' ); 870 } 871 872 function setAutorization() 873 { 874 var divItenContact = null; 875 876 if( arguments.length > 0 ) 877 { 878 var jidTo = arguments[0]; 879 880 if( getElement('itenContact_' + jidTo) ) 881 divItenContact = getElement('itenContact_' + jidTo ); 882 } 883 884 if( divItenContact ) 885 { 886 var subscription = divItenContact.getAttribute('subscription'); 887 888 switch(subscription) 889 { 890 case 'from': 518 } 519 else 520 { 521 _elementNext.style.display = "block"; 522 getElement("span_show_" + _elementNext.id ).style.display = "block"; 523 } 524 } 525 526 _elementNext = _elementNext.nextSibling; 527 } 528 } 529 } 530 531 function keyPressSearch() 532 { 533 if( arguments.length > 0 ) 534 { 535 var ev = arguments[0]; 536 var element = arguments[1]; 537 538 if ( ev.keyCode == 13 ) 539 if( element.value.length >= 3 ) 540 searchUser( element.value ); 541 else 542 alert( i18n.YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS + '.' ); 543 } 544 } 545 546 547 function loginPage() 548 { 549 var paramsLoginPage = 550 { 551 'username' : ((( Base64.decode(getUserCurrent().jid) )) ? Base64.decode(getUserCurrent().jid) : ""), 552 'password' : ((( Base64.decode(getUserCurrent().password) )) ? Base64.decode(getUserCurrent().password) : "") 553 } 554 555 var winLoginPage = 556 { 557 id_window : "window_login_page", 558 width : 260, 559 height : 120, 560 top : 100, 561 left : 400, 562 draggable : true, 563 visible : "display", 564 resizable : true, 565 zindex : zIndex++, 566 title : "Expresso Messenger - Login", 567 closeAction : "remove", 568 content : Xtools.parse(Xtools.xml("login_page"), "loginPage.xsl", paramsLoginPage) 569 }; 570 571 _winBuild( winLoginPage ); 572 } 573 574 function loadScripts(pFiles) 575 { 576 // Load JavaScript 577 var loadJavaScript = function(pJs) 578 { 579 var newScript = document.createElement("script"); 580 newScript.setAttribute("type", "text/javascript"); 581 newScript.setAttribute("src", pJs ); 582 583 return newScript; 584 }; 585 586 // Load CSS 587 var loadStyleSheet = function(pCss) 588 { 589 var newStyle = document.createElement("link"); 590 newStyle.setAttribute("rel", "stylesheet"); 591 newStyle.setAttribute("type", "text/css"); 592 newStyle.setAttribute("href", pCss); 593 594 return newStyle; 595 }; 596 597 for(var i = 0; i < pFiles.length; i++) 598 { 599 if( pFiles[i].indexOf(".js") > -1 ) 600 document.getElementsByTagName("head")[0].appendChild(loadJavaScript(pFiles[i])); 601 602 if( pFiles[i].indexOf(".css") > -1 ) 603 document.getElementsByTagName("head")[0].appendChild(loadStyleSheet(pFiles[i])); 604 } 605 } 606 607 function notificationNewMessage() 608 { 609 var _doc = document; 610 var _id = arguments[0]; 611 var _win_name = _id.replace( /\W/g, '' ); 612 613 if ( windowPOPUP( _id ) ) 614 { 615 _doc = windowPopUp[_win_name].document; 616 } 617 618 var oldTitle = _doc.title; 619 var newTitle = "## NOVA MENSAGEM ##"; 620 621 if( timeoutId == null ) 622 { 623 timeoutId = setInterval(function() 624 { 625 _doc.title = ( _doc.title == newTitle ) ? oldTitle : newTitle; 626 }, 1000); 627 628 configEvents( _doc, 'onclick', function() 629 { 630 clearInterval(timeoutId); 631 _doc.title = oldTitle; 632 timeoutId = null; 633 }); 634 635 configEvents( _doc, 'onkeypress', function() 636 { 637 clearInterval(timeoutId); 638 _doc.title = oldTitle; 639 timeoutId = null; 640 }); 641 } 642 } 643 644 function optionsItensContact() 645 { 646 if( arguments.length > 0 ) 647 { 648 var jid = arguments[0]; 649 var coord = arguments[1]; 650 var element = getElement('itenContact_' + jid ); 651 var action = ( element.getAttribute("subscription") === "not-in-roster" ) ? "Adicionar" : "Autorizar"; 652 653 if( showhidden == null ) 654 showhidden = new ShowHidden(300); 655 656 var _options = [ 657 [ action , 'loadscript.setAutorization(\''+jid+'\')'], 658 ['Remover' , 'loadscript.removeContact(\''+jid+'\')'], 659 ['Renomear' , 'loadscript.renameContact(\''+jid+'\')'], 660 ['Trocar grupo' , 'loadscript.renameGroup(\''+jid+'\')'] 661 ]; 662 663 var _itens = ""; 664 665 for( var i in _options ) 666 { 667 if( typeof(_options[i]) == "object") 668 { 669 _itens += '<img src="'+arrow_right.src+'"/>'; 670 _itens += '<span style="cursor:pointer;margin:3px;font-weight:normal;" onclick='+_options[i][1]+'>'; 671 _itens += _options[i][0] + '</span><br/>'; 672 } 673 } 674 675 var _optionsItens = document.createElement("div"); 676 _optionsItens.className = "x-menu"; 677 _optionsItens.style.top = coord.Y; 678 _optionsItens.style.left = ( coord.X - element.offsetLeft ); 679 _optionsItens.style.zIndex = getZindex(); 680 _optionsItens.innerHTML = _itens; 681 _optionsItens.onclick = function(){ 682 showhidden.hiddenObject(false); 683 }; 684 _optionsItens.onmouseout = function(){ 685 showhidden.hiddenObject(false); 686 }; 687 _optionsItens.onmouseover = function(){ 688 showhidden.hiddenObject(true); 689 }; 690 691 showhidden.action('onmouseover', 'onmouseout', _optionsItens); 692 693 window.document.body.appendChild(_optionsItens); 694 } 695 } 696 697 function parse() 698 { 699 if( arguments.length == 2 ) 700 return Xtools.parse(Xtools.xml(arguments[0]), arguments[1] ); 701 702 if( arguments.length === 3 ) 703 return Xtools.parse(Xtools.xml(arguments[0]), arguments[1], arguments[2] ); 704 } 705 706 function preferences() 707 { 708 var paramPreferences = 709 { 710 'path' : path, 711 'lang1' : 'Suas Preferências', 712 'lang2' : 'Conexão', 713 'lang3' : 'Conectar Automaticamente o IM', 714 'lang4' : 'Usuários OffLine', 715 'lang5' : 'Exibir amigos Offline', 716 'lang6' : 'Salvar', 717 'lang7' : 'Cancelar', 718 'lang8' : 'Janela de Contatos', 719 'lang9' : 'Abrir janela como Pop-up', 720 'lang10' : 'Ausente', 721 'lang11' : 'Definir status de ausente depois de', 722 'lang12' : 'minutos', 723 'lang13' : 'Mostrar Contatos', 724 'lang14' : 'Mostrar contatos desconectados', 725 'langYes': 'Sim', 726 'langNo' : 'Não' 727 }; 728 729 730 var _win_preferences = 731 { 732 id_window : "jabberit_preferences", 733 width : 430, 734 height : 350, 735 top : 150, 736 left : 100, 737 draggable : true, 738 visible : "display", 739 resizable : true, 740 zindex : zIndex++, 741 title : 'Expresso Messenger - Preferências', 742 closeAction : "remove", 743 content : Xtools.parse(Xtools.xml('preferences'), 'preferences.xsl', paramPreferences) 744 }; 745 746 _winBuild(_win_preferences); 747 748 749 var _pButtons = { 750 'lang1' : 'Salvar', 751 'lang2' : 'Fechar', 752 'onclickClose' : '_winBuild("jabberit_preferences","remove");', 753 'onclickSubmit' : 'javascript:loadscript.setPreferences();' 754 }; 755 756 document.getElementById('buttons_preferences_jabberit').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons); 757 758 // Element openWindowJabberit 759 var value1 = _preferencesIM[0].split(':'); 760 var element1 = document.getElementById(value1[0]); 761 var valueSelect1 = value1[1]; 762 763 for(var i = 0; i < element1.options.length; i++) 764 if( element1.options[i].value == valueSelect1 ) 765 element1.options[i].selected = true; 766 767 // Element openWindowJabberitPopUp 768 var value2 = _preferencesIM[1].split(':'); 769 770 // Element flagAwayIM 771 var value3 = _preferencesIM[2].split(':'); 772 var element3 = document.getElementById(value3[0]); 773 element3.value = value3[1]; 774 775 // Element showContactsOfflineJabberit 776 var value4 = _preferencesIM[3].split(':'); 777 var element4 = document.getElementById(value4[0]); 778 var valueSelect4 = value4[1]; 779 for(var i = 0; i < element4.options.length; i++) 780 if( element4.options[i].value == valueSelect4 ) 781 element4.options[i].selected = true; 782 } 783 784 function removeContact( jid ) 785 { 786 TrophyIM.removeContact( jid ); 787 } 788 789 function removeElement( ) 790 { 791 if( arguments.length > 0 ) 792 { 793 var _element = arguments[0] 794 795 if( _element != null ) 796 { 797 _element.parentNode.removeChild( _element ); 798 } 799 } 800 } 801 802 function removeGroup() 803 { 804 var _parent = arguments[0]; 805 806 if( _parent.childNodes.length <= 2 ) 807 _parent.parentNode.removeChild(_parent); 808 } 809 810 function renameContact() 811 { 812 if( arguments.length > 0 ) 813 { 814 var _jid = arguments[0]; 815 816 TrophyIM.renameContact( _jid ); 817 } 818 } 819 820 function renameGroup() 821 { 822 if( arguments.length > 0 ) 823 { 824 var _jid = arguments[0]; 825 826 TrophyIM.renameGroup( _jid ); 827 } 828 } 829 830 function rosterDiv() 831 { 832 var _rosterDiv = function() 833 { 834 835 var winRosterDiv = 836 { 837 id_window : "window_Roster_im", 838 width : 250, 839 height : 410, 840 top : 50, 841 left : -1500, 842 leftOld : 50, 843 draggable : true, 844 visible : "display", 845 resizable : true, 846 zindex : zIndex++, 847 title : "Expresso Messenger - Contatos", 848 closeAction : "hidden", 849 content : "" 850 }; 851 852 if( _preferencesIM[0] == "openWindowJabberit:false" ) 853 { 854 winRosterDiv.left = 50; 855 winRosterDiv.leftOld = -1500; 856 } 857 858 if( SnifferBrowser.isCompatible('chrome11','ie8','firefox3','firefox4','firefox5','epiphany2','iceweasel3','safari') ) 859 { 860 var _idUser = Base64.decode(getUserCurrent().jid); 861 862 var paramListContact = 863 { 864 'idUser' : _idUser, 865 'full_name' : (( fullName.length < 25 ) ? fullName : ( fullName.substring( 0, 25) + "...")), 866 'path_jabberit' : path_jabberit, 867 'help_expresso' : help_expresso, 868 'zIndex_' : zIndex++ 869 }; 870 871 winRosterDiv.content = Xtools.parse(Xtools.xml("contacts_list"),"contactsList.xsl", paramListContact) 872 873 } 874 else 875 { 876 var paramList = 877 { 878 'path' : path_phpgwapi 879 }; 880 881 winRosterDiv.width = 280; 882 winRosterDiv.height = 430; 883 winRosterDiv.content = Xtools.parse( Xtools.xml("navigator"), path_phpgwapi + "templates/default/xsl/navigatorCompatible.xsl" , paramList); 884 } 885 886 _winBuild( winRosterDiv ); 887 888 // Photo User 889 getPhotoUser(_idUser); 890 } 891 892 setTimeout( function(){ 893 _rosterDiv(); 894 }, 200 ); 895 } 896 897 function searchUser() 898 { 899 var _input = getElement('search_user_jabber'); 900 901 if( _input.value.length >= 3 ) 902 addUser.search(); 903 else 904 alert( i18n.YOUR_SEARCH_ARGUMENT_MUST_BE_LONGER_THAN_3_CHARACTERS + '.' ); 905 } 906 907 function setAutorization() 908 { 909 var divItenContact = null; 910 911 if( arguments.length > 0 ) 912 { 913 var jidTo = arguments[0]; 914 915 if( getElement('itenContact_' + jidTo) ) 916 divItenContact = getElement('itenContact_' + jidTo ); 917 } 918 919 if( divItenContact ) 920 { 921 var subscription = divItenContact.getAttribute('subscription'); 922 923 switch(subscription) 924 { 925 case 'from': 891 926 892 893 894 895 927 TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid ), 'subscribe'); 928 break; 929 930 case 'subscribe' : 896 931 897 898 932 TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid ), 'subscribed'); 933 break; 899 934 900 935 case 'none' : 901 936 902 903 937 TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid ), 'subscribe'); 938 break; 904 939 905 case 'to' :940 case 'to' : 906 941 907 908 909 910 911 942 TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid ), 'subscribed'); 943 removeElement( getElement('itenContactNotification_' + jidTo ) ); 944 break; 945 946 case 'not-in-roster': 912 947 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 948 TrophyIM.setAutorization( jidTo, Base64.decode(this.getUserCurrent().jid), 'subscribed'); 949 addUser.add( jidTo ); 950 break; 951 } 952 } 953 } 954 955 function setMessageStatus() 956 { 957 if( arguments.length > 0 ) 958 { 959 var _element = arguments[0]; 960 var _parent = _element.parentNode; 961 962 if( _element.nodeName.toLowerCase() == "label") 963 { 964 var _input = document.createElement("input"); 965 _input.size = "35"; 966 _input.maxlength = "35"; 967 _input.style.border = "0"; 968 _input.value = _element.innerHTML; 934 969 935 // OnkeyUp 936 configEvents( _input, "onkeyup", function(e) 937 { 938 if( e.keyCode == 13 ) loadscript.setMessageStatus(_input, _element); 939 } 940 ); 941 942 // Onblur 943 configEvents(_input, "onblur", function(){ loadscript.setMessageStatus(_input, _element)}); 970 // OnkeyUp 971 configEvents( _input, "onkeyup", function(e) 972 { 973 if( e.keyCode == 13 ) loadscript.setMessageStatus(_input, _element); 974 } 975 ); 976 977 // Onblur 978 configEvents(_input, "onblur", function(){ 979 loadscript.setMessageStatus(_input, _element) 980 }); 944 981 945 982 946 947 948 949 950 983 if( _parent != null ) 984 { 985 // Remove label 986 if( _element != null ) 987 _parent.removeChild( _element ); 951 988 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 989 // Add Input 990 if( _input != null ) 991 _parent.appendChild( _input ); 992 } 993 994 _input.focus(); 995 _input.select(); 996 } 997 else 998 { 999 var _label = arguments[1]; 1000 _statusMessage = _element.value.replace(/^\(+|\)+$/g,""); 1001 1002 if( ( _statusMessage = _statusMessage.replace(/^\s+|\s+$|^\n|\n$/g,"") ) != "") 1003 _label.innerHTML = "( " + _statusMessage + " )"; 1004 else 1005 _label.innerHTML = "( " + i18n.TYPE_YOUR_MESSAGE_HERE_STATUS + " )"; 1006 1007 if( _parent != null ) 1008 { 1009 // Remove Input 1010 if( _element != null ) 1011 _parent.removeChild( _element ); 975 1012 976 // Add Label 977 if( _label != null ) 978 _parent.appendChild( _label ); 979 } 980 981 // Send Status Message 982 _statusMessage = ( ( _statusMessage != i18n.TYPE_YOUR_MESSAGE_HERE_STATUS ) ? _statusMessage : "" ); 983 984 TrophyIM.setPresence("status", _statusMessage ); 985 } 986 } 987 } 988 989 function setPreferences() 990 { 991 // Element openWindowJabberit 992 var elementOpenW = document.getElementById('openWindowJabberit'); 993 var value = ''; 994 995 for(var i = 0 ; i < elementOpenW.options.length; i++) 996 if( elementOpenW.options[i].selected == true) 997 { 998 value = 'preferences1=openWindowJabberit:' + elementOpenW.options[i].value; 999 _preferencesIM[0] = 'openWindowJabberit:' + elementOpenW.options[i].value; 1000 } 1001 1002 // Element openWindowJabberitPopUp 1003 value += '&preferences2=openWindowJabberitPopUp:false'; 1004 _preferencesIM[1] = 'openWindowJabberitPopUp:false'; 1005 1006 // Element flagAwayIM 1007 var elementFlagIM = document.getElementById('flagAwayIM'); 1008 1009 if( elementFlagIM.value.length > 0 && parseInt(elementFlagIM.value) > 0 ) 1010 { 1011 _preferencesIM[2] = 'flagAwayIM:' + elementFlagIM.value; 1012 value += '&preferences3=flagAwayIM:' + elementFlagIM.value; 1013 } 1014 else 1015 { 1016 alert('Informe um valor igual ou maior que 1!'); 1017 return false; 1018 } 1019 1020 // Element showContactsOfflineJabberit 1021 var elementShowOffline = document.getElementById('showContactsOfflineJabberit'); 1022 1023 for(var i = 0 ; i < elementShowOffline.options.length; i++) 1024 if( elementShowOffline.options[i].selected == true) 1025 { 1026 _preferencesIM[3] = 'showContactsOfflineJabberit:' + elementShowOffline.options[i].value; 1027 value += '&preferences4=showContactsOfflineJabberit:' + elementShowOffline.options[i].value; 1028 } 1029 1030 // Save Preferences 1031 conn.go('p.pf.setPreferences', 1032 function(data) 1033 { 1034 if( data == 'false' ) 1035 { 1036 alert('Erro salvando suas preferências!'); 1037 } 1038 1039 _winBuild('jabberit_preferences', 'remove'); 1040 }, 1041 value); 1042 } 1043 1044 function setPresence() 1045 { 1046 if( arguments.length > 0 ) 1047 { 1048 var element = arguments[0]; 1049 1050 if( showhidden == null ) 1051 showhidden = new ShowHidden(300); 1052 1053 var _status = [ 1054 ['Afastado', 'away', '<img src="'+path_jabberit+'templates/default/images/away.gif" />'], 1055 ['Disponível', 'available', '<img src="'+path_jabberit+'templates/default/images/available.gif" />'], 1056 ['Livre p/ Conversa', 'chat', '<img src="'+path_jabberit+'templates/default/images/chat.gif" />'], 1057 ['Não Disponível', 'xa', '<img src="'+path_jabberit+'templates/default/images/xa.gif" />'], 1058 ['Ocupado', 'dnd', '<img src="'+path_jabberit+'templates/default/images/dnd.gif" />'], 1059 ['Desconectado', 'unavailable', '<img src="'+path_jabberit+'templates/default/images/unavailable.gif" />'], 1060 ['Mensagem de Status...', 'status', '<img src="'+path_jabberit+'templates/default/images/message_normal.gif" />'], 1061 ]; 1062 1063 var _itens = ""; 1064 1065 for( var i in _status ) 1066 { 1067 if( typeof( _status[i]) == "object" ) 1068 { 1069 _itens += '<span style="cursor:pointer;" onclick="TrophyIM.setPresence(\''+_status[i][1]+'\'); loadscript.setStatusJabber(\''+_status[i][0]+'\',\''+_status[i][1]+'\');">'; 1070 _itens += _status[i][2]+ "<span style='margin:3px;'>" + _status[i][0] + "</span></span><br/>"; 1071 } 1072 } 1073 1074 var _statusItens = document.createElement("div"); 1075 _statusItens.style.marginTop = "65px"; 1076 _statusItens.style.marginLeft = "67px"; 1077 _statusItens.className = "x-menu"; 1078 _statusItens.style.zIndex = '99999'; 1079 _statusItens.innerHTML = _itens; 1080 _statusItens.onclick = function(){ showhidden.hiddenObject(false); }; 1013 // Add Label 1014 if( _label != null ) 1015 _parent.appendChild( _label ); 1016 } 1017 1018 // Send Status Message 1019 _statusMessage = ( ( _statusMessage != i18n.TYPE_YOUR_MESSAGE_HERE_STATUS ) ? _statusMessage : "" ); 1020 1021 TrophyIM.setPresence("status", _statusMessage ); 1022 } 1023 } 1024 } 1025 1026 function setPreferences() 1027 { 1028 // Element openWindowJabberit 1029 var elementOpenW = document.getElementById('openWindowJabberit'); 1030 var value = ''; 1031 1032 for(var i = 0 ; i < elementOpenW.options.length; i++) 1033 if( elementOpenW.options[i].selected == true) 1034 { 1035 value = 'preferences1=openWindowJabberit:' + elementOpenW.options[i].value; 1036 _preferencesIM[0] = 'openWindowJabberit:' + elementOpenW.options[i].value; 1037 } 1038 1039 // Element openWindowJabberitPopUp 1040 value += '&preferences2=openWindowJabberitPopUp:false'; 1041 _preferencesIM[1] = 'openWindowJabberitPopUp:false'; 1042 1043 // Element flagAwayIM 1044 var elementFlagIM = document.getElementById('flagAwayIM'); 1045 1046 if( elementFlagIM.value.length > 0 && parseInt(elementFlagIM.value) > 0 ) 1047 { 1048 _preferencesIM[2] = 'flagAwayIM:' + elementFlagIM.value; 1049 value += '&preferences3=flagAwayIM:' + elementFlagIM.value; 1050 } 1051 else 1052 { 1053 alert('Informe um valor igual ou maior que 1!'); 1054 return false; 1055 } 1056 1057 // Element showContactsOfflineJabberit 1058 var elementShowOffline = document.getElementById('showContactsOfflineJabberit'); 1059 1060 for(var i = 0 ; i < elementShowOffline.options.length; i++) 1061 if( elementShowOffline.options[i].selected == true) 1062 { 1063 _preferencesIM[3] = 'showContactsOfflineJabberit:' + elementShowOffline.options[i].value; 1064 value += '&preferences4=showContactsOfflineJabberit:' + elementShowOffline.options[i].value; 1065 } 1066 1067 // Save Preferences 1068 conn.go('p.pf.setPreferences', 1069 function(data) 1070 { 1071 if( data == 'false' ) 1072 { 1073 alert('Erro salvando suas preferências!'); 1074 } 1075 1076 _winBuild('jabberit_preferences', 'remove'); 1077 }, 1078 value); 1079 } 1080 1081 function setPresence() 1082 { 1083 if( arguments.length > 0 ) 1084 { 1085 var element = arguments[0]; 1086 1087 if( showhidden == null ) 1088 showhidden = new ShowHidden(300); 1089 1090 var _status = [ 1091 ['Afastado', 'away', '<img src="'+path_jabberit+'templates/default/images/away.gif" />'], 1092 ['Disponível', 'available', '<img src="'+path_jabberit+'templates/default/images/available.gif" />'], 1093 ['Livre p/ Conversa', 'chat', '<img src="'+path_jabberit+'templates/default/images/chat.gif" />'], 1094 ['Não Disponível', 'xa', '<img src="'+path_jabberit+'templates/default/images/xa.gif" />'], 1095 ['Ocupado', 'dnd', '<img src="'+path_jabberit+'templates/default/images/dnd.gif" />'], 1096 ['Desconectado', 'unavailable', '<img src="'+path_jabberit+'templates/default/images/unavailable.gif" />'], 1097 ['Mensagem de Status...', 'status', '<img src="'+path_jabberit+'templates/default/images/message_normal.gif" />'], 1098 ]; 1099 1100 var _itens = ""; 1101 1102 for( var i in _status ) 1103 { 1104 if( typeof( _status[i]) == "object" ) 1105 { 1106 _itens += '<span style="cursor:pointer;" onclick="TrophyIM.setPresence(\''+_status[i][1]+'\'); loadscript.setStatusJabber(\''+_status[i][0]+'\',\''+_status[i][1]+'\');">'; 1107 _itens += _status[i][2]+ "<span style='margin:3px;'>" + _status[i][0] + "</span></span><br/>"; 1108 } 1109 } 1110 1111 var _statusItens = document.createElement("div"); 1112 _statusItens.style.marginTop = "65px"; 1113 _statusItens.style.marginLeft = "67px"; 1114 _statusItens.className = "x-menu"; 1115 _statusItens.style.zIndex = '99999'; 1116 _statusItens.innerHTML = _itens; 1117 _statusItens.onclick = function(){ 1118 showhidden.hiddenObject(false); 1119 }; 1081 1120 1082 showhidden.action('onmouseover', 'onmouseout', _statusItens); 1083 1084 element.parentNode.onmouseout = function(){ showhidden.hiddenObject(false); }; 1085 element.parentNode.onmouseover = function(){ showhidden.hiddenObject(true); }; 1086 element.parentNode.appendChild(_statusItens); 1087 } 1088 } 1089 1090 function setSelectEditable(element, top, left ) 1091 { 1092 if( getElement('selectBox0') == null ) 1093 selectEditable.create(element, top, left ); 1094 } 1095 1096 function setStatusJabber() 1097 { 1098 if( arguments.length > 0 ) 1099 { 1100 if( arguments[1] != 'status' ) 1101 { 1102 var _text = arguments[0]; 1103 var _img = statusUserIM = arguments[1]; 1104 1105 getElement('statusJabberText').innerHTML = _text; 1106 getElement('statusJabberImg').style.background = "url('"+path_jabberit+"templates/default/images/"+_img+".gif')"; 1107 getElement('status_jabber_expresso').style.background = "url('"+path_jabberit+"templates/default/images/"+_img+".gif') no-repeat"; 1108 } 1109 } 1110 } 1111 1112 function _setUserCurrent( _user ) 1113 { 1114 userCurrent = 1115 { 1116 'jid' : _user.jid.substring(11, _user.jid.length), 1117 'password' : _user.password.substring(11, _user.password.length) 1118 } 1119 } 1120 1121 function setUserCurrent() 1122 { 1123 if( getUserCurrent() == null ) 1124 { 1125 conn.go('p.ff.data_0', 1126 function(_User) 1127 { 1128 conn.go('p.ff.data_1', 1129 function(_pass) 1130 { 1131 _setUserCurrent( { jid : _User, password : _pass } ); 1132 }); 1133 }); 1134 } 1135 } 1136 1137 var _stylesheets = [ ]; 1138 var _links = document.getElementsByTagName( 'link' ); 1139 1140 for ( var i = 0; i < _links.length; i++ ) 1141 if ( _links.item( i ).type && _links.item( i ).type.toLowerCase( ) == 'text/css' ) 1142 _stylesheets[ _stylesheets.length ] = _links.item( i ); 1143 1144 function windowPOPUP() 1145 { 1146 var _id = arguments[0]; 1147 var _win_name = _id.replace( /\W/g, '' ); 1148 1149 if ( arguments.length == 1 ) 1150 { 1151 if ( windowPopUp[_win_name] ) 1152 return true; 1153 else 1154 return false; 1155 } 1156 1157 if( arguments.length == 2 ) 1158 { 1159 if( !windowPopUp[_win_name] ) 1160 { 1161 windowPopUp[_win_name] = window.open( '', _win_name + '__popup', 'height=355,width=380,top=50,left=50,toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no,titlebar=no'); 1162 var tmp = windowPopUp[_win_name].document; 1163 1164 tmp.write('<html><head>'); 1165 tmp.write('</head><body>'); 1166 tmp.write('</body></html>'); 1167 tmp.close(); 1168 1169 for ( var i = 0; i < _stylesheets.length; i++ ) 1170 tmp.documentElement.getElementsByTagName( 'head' ).item(0).appendChild( _stylesheets[ i ].cloneNode( true ) ); 1171 1172 var divPOP = getElement( _id + "__popUp" ); 1173 divPOP.style.background = "url('"+path_jabberit+"templates/default/images/icon_down.png') no-repeat"; 1174 divPOP.innerHTML = "PopIn"; 1121 showhidden.action('onmouseover', 'onmouseout', _statusItens); 1122 1123 element.parentNode.onmouseout = function(){ 1124 showhidden.hiddenObject(false); 1125 }; 1126 element.parentNode.onmouseover = function(){ 1127 showhidden.hiddenObject(true); 1128 }; 1129 element.parentNode.appendChild(_statusItens); 1130 } 1131 } 1132 1133 function setSelectEditable(element, top, left ) 1134 { 1135 if( getElement('selectBox0') == null ) 1136 selectEditable.create(element, top, left ); 1137 } 1138 1139 function setStatusJabber() 1140 { 1141 if( arguments.length > 0 ) 1142 { 1143 if( arguments[1] != 'status' ) 1144 { 1145 var _text = arguments[0]; 1146 var _img = statusUserIM = arguments[1]; 1147 1148 getElement('statusJabberText').innerHTML = _text; 1149 getElement('statusJabberImg').style.background = "url('"+path_jabberit+"templates/default/images/"+_img+".gif')"; 1150 getElement('status_jabber_expresso').style.background = "url('"+path_jabberit+"templates/default/images/"+_img+".gif') no-repeat"; 1151 } 1152 } 1153 } 1154 1155 function _setUserCurrent( _user ) 1156 { 1157 userCurrent = 1158 { 1159 'jid' : _user.jid.substring(11, _user.jid.length), 1160 'password' : _user.password.substring(11, _user.password.length) 1161 } 1162 } 1163 1164 function setUserCurrent() 1165 { 1166 if( getUserCurrent() == null ) 1167 { 1168 conn.go('p.ff.data_0', 1169 function(_User) 1170 { 1171 conn.go('p.ff.data_1', 1172 function(_pass) 1173 { 1174 _setUserCurrent( { 1175 jid : _User, 1176 password : _pass 1177 } ); 1178 }); 1179 }); 1180 } 1181 } 1182 1183 var _stylesheets = [ ]; 1184 var _links = document.getElementsByTagName( 'link' ); 1185 1186 for ( var i = 0; i < _links.length; i++ ) 1187 if ( _links.item( i ).type && _links.item( i ).type.toLowerCase( ) == 'text/css' ) 1188 _stylesheets[ _stylesheets.length ] = _links.item( i ); 1189 1190 function windowPOPUP() 1191 { 1192 var _id = arguments[0]; 1193 var _win_name = _id.replace( /\W/g, '' ); 1194 1195 if ( arguments.length == 1 ) 1196 { 1197 if ( windowPopUp[_win_name] ) 1198 return true; 1199 else 1200 return false; 1201 } 1202 1203 if( arguments.length == 2 ) 1204 { 1205 if( !windowPopUp[_win_name] ) 1206 { 1207 windowPopUp[_win_name] = window.open( '', _win_name + '__popup', 'height=355,width=380,top=50,left=50,toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no,titlebar=no'); 1208 var tmp = windowPopUp[_win_name].document; 1209 1210 tmp.write('<html><head>'); 1211 tmp.write('</head><body>'); 1212 tmp.write('</body></html>'); 1213 tmp.close(); 1214 1215 for ( var i = 0; i < _stylesheets.length; i++ ) 1216 tmp.documentElement.getElementsByTagName( 'head' ).item(0).appendChild( _stylesheets[ i ].cloneNode( true ) ); 1217 1218 var divPOP = getElement( _id + "__popUp" ); 1219 divPOP.style.background = "url('"+path_jabberit+"templates/default/images/icon_down.png') no-repeat"; 1220 divPOP.innerHTML = "PopIn"; 1175 1221 1176 1177 1178 1179 1180 1222 function _close( ) 1223 { 1224 windowPopUp[_win_name].close(); 1225 configEvents( divPOP ,'onclick', _close, true ); 1226 } 1181 1227 1182 configEvents( divPOP ,'onclick', _close ); 1183 1184 var _content = tmp.documentElement.getElementsByTagName( 'body' ).item(0).appendChild( getElement(_id + '__chatBox' ).parentNode ); 1185 1186 _content.firstChild.scrollTop = _content.firstChild.scrollHeight; 1187 1188 configEvents( windowPopUp[_win_name] ,'onbeforeunload', function() 1189 { 1190 delete windowPopUp[_win_name]; 1191 divPOP.style.background = "url('"+path_jabberit+"templates/default/images/icon_up.png') no-repeat"; 1192 divPOP.innerHTML = "PopUp"; 1193 divPOP.onclick = function(){ loadscript.windowPOPUP( _id , true ); }; 1194 _winBuild( 'window_chat_area_' + _id, "display" ).content( true ); 1195 }); 1196 1197 _winBuild( 'window_chat_area_' + _id, 'hidden' ); 1198 } 1199 } 1200 } 1201 1202 function windowNotificationNewUsers() 1203 { 1204 var _users = Xtools.xml('notification_new_users'); 1205 1206 for( var user in TrophyIM.rosterObj.roster ) 1207 { 1208 if ( TrophyIM.rosterObj.roster[ user ].constructor == Function ) 1209 continue; 1210 1211 if( TrophyIM.rosterObj.roster[ user ].contact.jid != Base64.decode( loadscript.getUserCurrent().jid) ) 1212 { 1213 var _subscription = TrophyIM.rosterObj.roster[user].contact.subscription; 1214 1215 if ( _subscription == 'to' || _subscription == 'not-in-roster' ) 1216 { 1217 var _user = _users.createElement('user'); 1218 var _jid = _users.createElement('jid'); 1219 var _status = _users.createElement('status'); 1220 _jid.appendChild( _users.createTextNode(TrophyIM.rosterObj.roster[user].contact.jid) ); 1221 _status.appendChild( _users.createTextNode( _subscription ) ); 1222 _user.appendChild( _jid ); 1223 _user.appendChild( _status ); 1224 _users.documentElement.appendChild( _user ); 1225 } 1226 } 1227 } 1228 1229 var paramsNotification = 1230 { 1231 'lang_1' : "Notificação", 1232 'lang_2' : "O(s) usuário(s) abaixo pedem sua autorização.", 1233 'lang_3' : "Autorizar", 1234 'lang_4' : "Remover" 1235 }; 1236 1237 var winNotification = 1238 { 1239 id_window : "window_notification_new_users", 1240 width : 400, 1241 height : 300, 1242 top : 100, 1243 left : 400, 1244 draggable : true, 1245 visible : "display", 1246 resizable : true, 1247 zindex : zIndex++, 1248 title : "Expresso Messenger - Notificação de Novos Usuários", 1249 closeAction : "remove", 1250 content : Xtools.parse( _users , "notificationNewUsers.xsl", paramsNotification ) 1251 }; 1252 1253 _winBuild( winNotification ); 1254 } 1255 1256 function createChatRooms() 1257 { 1258 _winBuild("window_List_Rooms_jabberit_messenger","remove"); 1259 1260 var paramCreateChatRoom = 1261 { 1262 'lang_nameChatRoom' : "Nome da Sala", 1263 'lang_nickName' : "Apelido" 1264 }; 1265 1266 var winCreateChatRooms = 1267 { 1268 id_window : "window_create_chat_rooms", 1269 width : 360, 1270 height : 160, 1271 top : 100, 1272 left : 410, 1273 draggable : true, 1274 visible : "display", 1275 resizable : true, 1276 zindex : loadscript.getZIndex(), 1277 title : "Expresso Messenger - Criar Sala de Bate Papo", 1278 closeAction : "remove", 1279 content : Xtools.parse( Xtools.xml("create_chat_room"), "createChatRoom.xsl", paramCreateChatRoom ) 1280 }; 1281 1282 _winBuild( winCreateChatRooms ); 1283 1284 var _pButtons = 1285 { 1286 'lang1' : 'Ingressar', 1287 'lang2' : 'Fechar', 1288 'onclickClose' : '_winBuild("window_create_chat_rooms","remove");', 1289 'onclickSubmit' : 'TrophyIM.createChatRooms(); _winBuild("window_create_chat_rooms","remove");' 1290 }; 1291 1292 // Add Buttons 1293 document.getElementById('buttons_createChatRoom').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons); 1294 1295 } 1296 1297 function listRooms( element ) 1298 { 1299 element = element.getElementsByTagName( 'item' ); 1300 1301 var _roomsCount = 0; 1302 var _xml = Xtools.xml('listRooms'); 1303 var _listRooms = _xml.documentElement; 1304 1305 var show = function( ) 1306 { 1307 if ( _roomsCount != element.length ) 1308 return false; 1309 1310 var paramsListRooms = 1311 { 1312 "path_jabberit" : path_jabberit 1313 }; 1314 1315 var winListRooms = 1316 { 1317 id_window : "window_List_Rooms_jabberit_messenger", 1318 width : 450, 1319 height : 300, 1320 top : 100, 1321 left : 400, 1322 draggable : true, 1323 visible : "display", 1324 resizable : true, 1325 zindex : loadscript.getZIndex(), 1326 title : "Expresso Messenger - Salas de Bate Papo", 1327 closeAction : "remove", 1328 content : Xtools.parse( _xml, "listRooms.xsl", paramsListRooms ) 1329 }; 1330 1331 _winBuild( winListRooms ); 1332 1333 var _pButtons = 1334 { 1335 'lang1' : 'Criar Nova Sala', 1336 'lang2' : 'Fechar', 1337 'onclickClose' : '_winBuild("window_List_Rooms_jabberit_messenger","remove");', 1338 'onclickSubmit' : 'loadscript.createChatRooms();' 1339 }; 1340 1341 // Add Buttons 1342 document.getElementById('buttons_addChatRoom').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons); 1343 }; 1344 1345 var _add_room = function( _room ) 1346 { 1347 _roomsCount++; 1348 1349 var _ROOM = _xml.createElement('room'); 1350 var _JIDROOM = _xml.createElement('jidRoom'); 1351 var nameRoom = _room.getAttribute( 'from' ); 1352 1353 _ROOM.setAttribute( 'nameRoom', unescape((nameRoom.substring(0, nameRoom.indexOf("@"))).toUpperCase()) ); 1354 _JIDROOM.appendChild( _xml.createTextNode(nameRoom) ); 1355 _ROOM.appendChild( _JIDROOM ); 1356 1357 // Get fields elements; 1358 var _fields = _room.getElementsByTagName( 'field' ); 1359 1360 for ( var f = 0; f < _fields.length; f++ ) 1361 { 1362 if ( _fields[ f ].getAttribute( 'var' ) ) 1363 { 1364 if ( _fields[ f ].firstChild.hasChildNodes( ) && _fields[ f ].getAttribute( 'var' ) == 'muc#roominfo_description' ) 1365 { 1366 var _description = _xml.createElement("description"); 1367 _description.appendChild( _xml.createTextNode( _fields[ f ].firstChild.firstChild.nodeValue ) ); 1368 _ROOM.appendChild( _description ); 1369 } 1370 1371 if ( _fields[ f ].firstChild.hasChildNodes( ) && _fields[ f ].getAttribute( 'var' ) == 'muc#roominfo_occupants' ) 1372 { 1373 var _occupants = _xml.createElement("occupants") 1374 _occupants.appendChild( _xml.createTextNode( _fields[ f ].firstChild.firstChild.nodeValue) ); 1375 _ROOM.appendChild( _occupants ); 1376 } 1377 } 1378 } 1379 1380 // Get feature elements; 1381 var _feature = _room.getElementsByTagName( 'feature' ); 1382 1383 for( var f = 0 ; f < _feature.length; f++ ) 1384 { 1385 if ( _feature[ f ].getAttribute( 'var' ) ) 1386 { 1387 if( _feature[ f ].getAttribute( 'var' ) == 'muc_unsecured' ) 1388 { 1389 var _password = _xml.createElement("password"); 1390 _password.appendChild( _xml.createTextNode("false") ); 1391 _ROOM.appendChild( _password ); 1392 } 1393 else if( _feature[ f ].getAttribute( 'var' ) == 'muc_passwordprotected' ) 1394 { 1395 var _password = _xml.createElement("password"); 1396 _password.appendChild( _xml.createTextNode("true") ); 1397 _ROOM.appendChild( _password ); 1398 } 1399 } 1400 } 1401 1402 _listRooms.appendChild( _ROOM ); 1403 1404 show( ); 1405 }; 1406 1407 var _get_room_info = function( _room ) 1408 { 1409 TrophyIM.connection.sendIQ( 1410 $iq( { "to" : _room, "type" : "get" } ).c( "query",{xmlns: Strophe.NS.DISCO_INFO } ), 1411 _add_room, 1412 function( a ) 1413 { 1414 _roomsCount++; 1228 configEvents( divPOP ,'onclick', _close ); 1229 1230 var _content = tmp.documentElement.getElementsByTagName( 'body' ).item(0).appendChild( getElement(_id + '__chatBox' ).parentNode ); 1231 1232 _content.firstChild.scrollTop = _content.firstChild.scrollHeight; 1233 1234 configEvents( windowPopUp[_win_name] ,'onbeforeunload', function() 1235 { 1236 delete windowPopUp[_win_name]; 1237 divPOP.style.background = "url('"+path_jabberit+"templates/default/images/icon_up.png') no-repeat"; 1238 divPOP.innerHTML = "PopUp"; 1239 divPOP.onclick = function(){ 1240 loadscript.windowPOPUP( _id , true ); 1241 }; 1242 _winBuild( 'window_chat_area_' + _id, "display" ).content( true ); 1243 }); 1244 1245 _winBuild( 'window_chat_area_' + _id, 'hidden' ); 1246 } 1247 } 1248 } 1249 1250 function windowNotificationNewUsers() 1251 { 1252 var _users = Xtools.xml('notification_new_users'); 1253 1254 for( var user in TrophyIM.rosterObj.roster ) 1255 { 1256 if ( TrophyIM.rosterObj.roster[ user ].constructor == Function ) 1257 continue; 1258 1259 if( TrophyIM.rosterObj.roster[ user ].contact.jid != Base64.decode( loadscript.getUserCurrent().jid) ) 1260 { 1261 var _subscription = TrophyIM.rosterObj.roster[user].contact.subscription; 1262 1263 if ( _subscription == 'to' || _subscription == 'not-in-roster' ) 1264 { 1265 var _user = _users.createElement('user'); 1266 var _jid = _users.createElement('jid'); 1267 var _status = _users.createElement('status'); 1268 _jid.appendChild( _users.createTextNode(TrophyIM.rosterObj.roster[user].contact.jid) ); 1269 _status.appendChild( _users.createTextNode( _subscription ) ); 1270 _user.appendChild( _jid ); 1271 _user.appendChild( _status ); 1272 _users.documentElement.appendChild( _user ); 1273 } 1274 } 1275 } 1276 1277 var paramsNotification = 1278 { 1279 'lang_1' : "Notificação", 1280 'lang_2' : "O(s) usuário(s) abaixo pedem sua autorização.", 1281 'lang_3' : "Autorizar", 1282 'lang_4' : "Remover" 1283 }; 1284 1285 var winNotification = 1286 { 1287 id_window : "window_notification_new_users", 1288 width : 400, 1289 height : 300, 1290 top : 100, 1291 left : 400, 1292 draggable : true, 1293 visible : "display", 1294 resizable : true, 1295 zindex : zIndex++, 1296 title : "Expresso Messenger - Notificação de Novos Usuários", 1297 closeAction : "remove", 1298 content : Xtools.parse( _users , "notificationNewUsers.xsl", paramsNotification ) 1299 }; 1300 1301 _winBuild( winNotification ); 1302 } 1303 1304 function createChatRooms() 1305 { 1306 _winBuild("window_List_Rooms_jabberit_messenger","remove"); 1307 1308 var paramCreateChatRoom = 1309 { 1310 'lang_nameChatRoom' : "Nome da Sala", 1311 'lang_nickName' : "Apelido" 1312 }; 1313 1314 var winCreateChatRooms = 1315 { 1316 id_window : "window_create_chat_rooms", 1317 width : 360, 1318 height : 160, 1319 top : 100, 1320 left : 410, 1321 draggable : true, 1322 visible : "display", 1323 resizable : true, 1324 zindex : loadscript.getZIndex(), 1325 title : "Expresso Messenger - Criar Sala de Bate Papo", 1326 closeAction : "remove", 1327 content : Xtools.parse( Xtools.xml("create_chat_room"), "createChatRoom.xsl", paramCreateChatRoom ) 1328 }; 1329 1330 _winBuild( winCreateChatRooms ); 1331 1332 var _pButtons = 1333 { 1334 'lang1' : 'Ingressar', 1335 'lang2' : 'Fechar', 1336 'onclickClose' : '_winBuild("window_create_chat_rooms","remove");', 1337 'onclickSubmit' : 'TrophyIM.createChatRooms(); _winBuild("window_create_chat_rooms","remove");' 1338 }; 1339 1340 // Add Buttons 1341 document.getElementById('buttons_createChatRoom').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons); 1342 1343 } 1344 1345 function listRooms( element ) 1346 { 1347 element = element.getElementsByTagName( 'item' ); 1348 1349 var _roomsCount = 0; 1350 var _xml = Xtools.xml('listRooms'); 1351 var _listRooms = _xml.documentElement; 1352 1353 var show = function( ) 1354 { 1355 if ( _roomsCount != element.length ) 1356 return false; 1357 1358 var paramsListRooms = 1359 { 1360 "path_jabberit" : path_jabberit 1361 }; 1362 1363 var winListRooms = 1364 { 1365 id_window : "window_List_Rooms_jabberit_messenger", 1366 width : 450, 1367 height : 300, 1368 top : 100, 1369 left : 400, 1370 draggable : true, 1371 visible : "display", 1372 resizable : true, 1373 zindex : loadscript.getZIndex(), 1374 title : "Expresso Messenger - Salas de Bate Papo", 1375 closeAction : "remove", 1376 content : Xtools.parse( _xml, "listRooms.xsl", paramsListRooms ) 1377 }; 1378 1379 _winBuild( winListRooms ); 1380 1381 var _pButtons = 1382 { 1383 'lang1' : 'Criar Nova Sala', 1384 'lang2' : 'Fechar', 1385 'onclickClose' : '_winBuild("window_List_Rooms_jabberit_messenger","remove");', 1386 'onclickSubmit' : 'loadscript.createChatRooms();' 1387 }; 1388 1389 // Add Buttons 1390 document.getElementById('buttons_addChatRoom').innerHTML = Xtools.parse(Xtools.xml('buttons_main'), 'buttons.xsl', _pButtons); 1391 }; 1392 1393 var _add_room = function( _room ) 1394 { 1395 _roomsCount++; 1396 1397 var _ROOM = _xml.createElement('room'); 1398 var _JIDROOM = _xml.createElement('jidRoom'); 1399 var nameRoom = _room.getAttribute( 'from' ); 1400 1401 _ROOM.setAttribute( 'nameRoom', unescape((nameRoom.substring(0, nameRoom.indexOf("@"))).toUpperCase()) ); 1402 _JIDROOM.appendChild( _xml.createTextNode(nameRoom) ); 1403 _ROOM.appendChild( _JIDROOM ); 1404 1405 // Get fields elements; 1406 var _fields = _room.getElementsByTagName( 'field' ); 1407 1408 for ( var f = 0; f < _fields.length; f++ ) 1409 { 1410 if ( _fields[ f ].getAttribute( 'var' ) ) 1411 { 1412 if ( _fields[ f ].firstChild.hasChildNodes( ) && _fields[ f ].getAttribute( 'var' ) == 'muc#roominfo_description' ) 1413 { 1414 var _description = _xml.createElement("description"); 1415 _description.appendChild( _xml.createTextNode( _fields[ f ].firstChild.firstChild.nodeValue ) ); 1416 _ROOM.appendChild( _description ); 1417 } 1418 1419 if ( _fields[ f ].firstChild.hasChildNodes( ) && _fields[ f ].getAttribute( 'var' ) == 'muc#roominfo_occupants' ) 1420 { 1421 var _occupants = _xml.createElement("occupants") 1422 _occupants.appendChild( _xml.createTextNode( _fields[ f ].firstChild.firstChild.nodeValue) ); 1423 _ROOM.appendChild( _occupants ); 1424 } 1425 } 1426 } 1427 1428 // Get feature elements; 1429 var _feature = _room.getElementsByTagName( 'feature' ); 1430 1431 for( var f = 0 ; f < _feature.length; f++ ) 1432 { 1433 if ( _feature[ f ].getAttribute( 'var' ) ) 1434 { 1435 if( _feature[ f ].getAttribute( 'var' ) == 'muc_unsecured' ) 1436 { 1437 var _password = _xml.createElement("password"); 1438 _password.appendChild( _xml.createTextNode("false") ); 1439 _ROOM.appendChild( _password ); 1440 } 1441 else if( _feature[ f ].getAttribute( 'var' ) == 'muc_passwordprotected' ) 1442 { 1443 var _password = _xml.createElement("password"); 1444 _password.appendChild( _xml.createTextNode("true") ); 1445 _ROOM.appendChild( _password ); 1446 } 1447 } 1448 } 1449 1450 _listRooms.appendChild( _ROOM ); 1451 1452 show( ); 1453 }; 1454 1455 var _get_room_info = function( _room ) 1456 { 1457 TrophyIM.connection.sendIQ( 1458 $iq( { 1459 "to" : _room, 1460 "type" : "get" 1461 } ).c( "query",{ 1462 xmlns: Strophe.NS.DISCO_INFO 1463 } ), 1464 _add_room, 1465 function( a ) 1466 { 1467 _roomsCount++; 1415 1468 1416 1469 show( ); 1417 1470 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1471 }, 500 ); 1472 }; 1473 1474 if( element.length > 0 ) 1475 { 1476 for ( var i = 0; i < element.length; i++ ) 1477 { 1478 _get_room_info( element[ i ].getAttribute( 'jid' ) ); 1479 } 1480 } 1481 else 1482 { 1483 show(); 1484 } 1485 } 1486 1487 function getListRooms() 1488 { 1489 TrophyIM.getListRooms(); 1490 } 1491 1492 function joinRoom( jidRoom, nameRoom ) 1493 { 1494 var append_nick = function( room, nick ) 1495 { 1496 var room_nick = room; 1444 1497 1445 1446 1447 1448 1498 if ( nick ) 1499 { 1500 room_nick += "/" + nick; 1501 } 1449 1502 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1503 return room_nick; 1504 } 1505 1506 if( document.getElementById( 'window_chat_room_' + jidRoom + '__main' ) != null ) 1507 { 1508 _winBuild('window_chat_room_' + jidRoom, 'display'); 1509 } 1510 else 1511 { 1512 var nickName = Base64.decode( loadscript.getUserCurrent().jid ); 1513 nickName = nickName.substring(0, nickName.indexOf('@')); 1461 1514 1462 1515 var _prompt = prompt("Deseja informar um Apelido ?", nickName ); 1463 1516 1464 1465 1466 1517 if( _prompt ) 1518 { 1519 _prompt = _prompt.replace(/^\s+|\s+$|^\n|\n$/g,""); 1467 1520 1468 1521 var room_nick = append_nick( jidRoom, nickName ); 1469 1522 1470 1523 var nickChat = nickName.toString(); 1471 1524 1472 1473 1474 1475 1476 1525 if( _prompt && _prompt != "" ) 1526 { 1527 nickChat = _prompt.toString(); 1528 var room_nick = append_nick( jidRoom, _prompt ); 1529 } 1477 1530 1478 1479 1480 1531 TrophyIM.makeChatRoom( jidRoom , nameRoom ); 1532 1533 TrophyIM.activeChatRoom.name[ TrophyIM.activeChatRoom.name.length ] = room_nick; 1481 1534 1482 1535 TrophyIM.joinChatRoom( room_nick); 1483 1536 1484 1485 1486 1537 setTimeout(function() 1538 { 1539 var _message = nickName.toUpperCase() + " entrou como : " + nickChat; 1487 1540 1488 1541 TrophyIM.sendMessageChatRoom( jidRoom , _message ); 1489 1542 1490 1543 }, 500); 1491 1544 1492 1493 1545 } 1546 } 1494 1547 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1548 _winBuild("window_List_Rooms_jabberit_messenger","remove"); 1549 } 1550 1551 function loadIM() 1552 { 1553 if( arguments.length > 0 ) 1554 { 1555 var files = [ 1556 path_jabberit + 'templates/default/css/button.css', 1557 path_jabberit + 'templates/default/css/common.css', 1558 path_jabberit + 'templates/default/css/selectEditableStyle.css', 1559 path_jabberit + 'templates/default/css/' + theme_jabberit 1560 ]; 1561 // FullName 1562 fullName = arguments[0]; 1563 1564 // Preferences 1565 _preferencesIM = arguments[1].split(";"); 1513 1566 1514 1515 1567 //Path Phpgwapi 1568 path_phpgwapi = arguments[2]; 1516 1569 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1570 if( !_preferencesIM[3] ) _preferencesIM[3] = "showContactsOfflineJabberit:true"; 1571 1572 loadScripts(files); 1573 1574 setTimeout(function() 1575 { 1576 // Object Xtools 1577 if( Xtools == null ) 1578 Xtools = new xtools(path_jabberit); 1579 1580 // Object Conector 1581 if( conn == null ) 1582 conn = new AjaxConnector(path_jabberit); 1583 1584 // Object Add User 1585 if( addUser == null ) 1586 addUser = new addUserIM(Xtools, conn); 1587 1588 1589 // Object SelectEditable 1590 if( selectEditable == null ) 1591 selectEditable = new SelectEditable(); 1539 1592 1540 1541 1542 1543 1544 1545 1546 1547 1548 if( SnifferBrowser.isCompatible('ie8','firefox3','firefox4','epiphany2','iceweasel3') )1549 1550 1593 // Add Jabber in StatusBar; 1594 addIcon(); 1595 1596 // Auto Connect 1597 setTimeout(function() 1598 { 1599 if( _preferencesIM[0] === 'openWindowJabberit:true' ) 1600 { 1601 if( SnifferBrowser.isCompatible('chrome11','ie8','firefox3','firefox4','firefox5','epiphany2','iceweasel3','safari') ) 1602 TrophyIM.load(); 1603 } 1551 1604 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 loadIM.prototype.getIsIE = getIsIE;1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 })();1605 },1500); 1606 1607 // Auto Status 1608 autoStatus(); 1609 configEvents( document, 'onmousemove', autoStatus ); 1610 configEvents( document, 'onkeypress', autoStatus ); 1611 1612 }, 2000); 1613 } 1614 } 1615 1616 loadIM.prototype.adIcon = addIcon; 1617 loadIM.prototype.actionButton = actionButton; 1618 loadIM.prototype.addContact = addContact; 1619 loadIM.prototype.addNewUser = addNewUser; 1620 loadIM.prototype.clrAllContacts = clrAllContacts; 1621 loadIM.prototype.configEvents = configEvents; 1622 loadIM.prototype.createChatRooms = createChatRooms; 1623 loadIM.prototype.disabledNotificationNewUsers = disabledNotificationNewUsers; 1624 loadIM.prototype.enabledNotificationNewUsers = enabledNotificationNewUsers; 1625 loadIM.prototype.getListRooms = getListRooms; 1626 loadIM.prototype.getBrowserCompatible = getBrowserCompatible; 1627 loadIM.prototype.getPhotoUser = getPhotoUser; 1628 loadIM.prototype.getSmiles = getSmiles; 1629 loadIM.prototype.getStatusUserIM = getStatusUserIM; 1630 loadIM.prototype.getStatusMessage = getStatusMessage; 1631 loadIM.prototype.getShowContactsOffline = getShowContactsOffline; 1632 loadIM.prototype.getUserCurrent = getUserCurrent; 1633 loadIM.prototype.getZIndex = getZindex; 1634 loadIM.prototype.groupsHidden = groupsHidden; 1635 loadIM.prototype.groupsVisible = groupsVisible; 1636 loadIM.prototype.joinRoom = joinRoom; 1637 loadIM.prototype.keyPressSearch = keyPressSearch; 1638 loadIM.prototype.listRooms = listRooms; 1639 loadIM.prototype.loginPage = loginPage; 1640 loadIM.prototype.notification = notificationNewMessage; 1641 loadIM.prototype.parse = parse; 1642 loadIM.prototype.preferences = preferences; 1643 loadIM.prototype.searchUser = searchUser 1644 loadIM.prototype.setAutorization = setAutorization; 1645 loadIM.prototype.setMessageStatus = setMessageStatus; 1646 loadIM.prototype.setPreferences = setPreferences; 1647 loadIM.prototype.setPresence = setPresence; 1648 loadIM.prototype.setStatusJabber = setStatusJabber; 1649 loadIM.prototype.setSelectEditable = setSelectEditable; 1650 loadIM.prototype.setUserCurrent = setUserCurrent; 1651 loadIM.prototype.removeContact = removeContact; 1652 loadIM.prototype.removeElement = removeElement; 1653 loadIM.prototype.removeGroup = removeGroup; 1654 loadIM.prototype.renameContact = renameContact; 1655 loadIM.prototype.renameGroup = renameGroup; 1656 loadIM.prototype.rosterDiv = rosterDiv; 1657 loadIM.prototype.windowNotificationNewUsers = windowNotificationNewUsers; 1658 loadIM.prototype.windowPOPUP = windowPOPUP; 1659 1660 window.LoadIM = loadIM; 1661 1662 // Necessário para não ocasionar problema no ExpressoMail 1663 // quando os itens abaixo não são criados pelo próprio ExpressoMail 1664 if( SnifferBrowser.isCompatible('is_ie') ) 1665 { 1666 configEvents( window, 'onload', function( ) 1667 { 1668 if ( ! document.getElementById( 'cc_msg_err_serialize_data_unknown' ) ) 1669 { 1670 var fix = document.createElement('input'); 1671 fix.type = 'hidden'; 1672 fix.id = 'cc_msg_err_serialize_data_unknown'; 1673 1674 document.appendChild( fix ); 1675 } 1676 if ( ! window.showMessage ) 1677 window.showMessage = function(){}; 1678 }); 1679 } 1680 1681 })(); -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/jmessenger/js/jscode/loadIM.mini.js
r4442 r4644 83 83 function getElement(elementId) 84 84 {return document.getElementById(elementId);} 85 function get IsIE()86 {return SnifferBrowser.isCompatible(' is_ie');}85 function getBrowserCompatible() 86 {return SnifferBrowser.isCompatible('firefox3','firefox4','firefox5');} 87 87 function getPhotoUser(jid) 88 88 {try … … 180 180 {var winRosterDiv={id_window:"window_Roster_im",width:250,height:410,top:50,left:-1500,leftOld:50,draggable:true,visible:"display",resizable:true,zindex:zIndex++,title:"Expresso Messenger - Contatos",closeAction:"hidden",content:""};if(_preferencesIM[0]=="openWindowJabberit:false") 181 181 {winRosterDiv.left=50;winRosterDiv.leftOld=-1500;} 182 if(SnifferBrowser.isCompatible(' ie8','firefox3','firefox4','epiphany2','iceweasel3'))182 if(SnifferBrowser.isCompatible('chrome11','ie8','firefox3','firefox4','firefox5','epiphany2','iceweasel3','safari')) 183 183 {var _idUser=Base64.decode(getUserCurrent().jid);var paramListContact={'idUser':_idUser,'full_name':((fullName.length<25)?fullName:(fullName.substring(0,25)+"...")),'path_jabberit':path_jabberit,'help_expresso':help_expresso,'zIndex_':zIndex++};winRosterDiv.content=Xtools.parse(Xtools.xml("contacts_list"),"contactsList.xsl",paramListContact)} 184 184 else … … 322 322 selectEditable=new SelectEditable();addIcon();setTimeout(function() 323 323 {if(_preferencesIM[0]==='openWindowJabberit:true') 324 {if(SnifferBrowser.isCompatible(' ie8','firefox3','firefox4','epiphany2','iceweasel3'))324 {if(SnifferBrowser.isCompatible('chrome11','ie8','firefox3','firefox4','firefox5','epiphany2','iceweasel3','safari')) 325 325 TrophyIM.load();}},1500);autoStatus();configEvents(document,'onmousemove',autoStatus);configEvents(document,'onkeypress',autoStatus);},2000);}} 326 loadIM.prototype.adIcon=addIcon;loadIM.prototype.actionButton=actionButton;loadIM.prototype.addContact=addContact;loadIM.prototype.addNewUser=addNewUser;loadIM.prototype.clrAllContacts=clrAllContacts;loadIM.prototype.configEvents=configEvents;loadIM.prototype.createChatRooms=createChatRooms;loadIM.prototype.disabledNotificationNewUsers=disabledNotificationNewUsers;loadIM.prototype.enabledNotificationNewUsers=enabledNotificationNewUsers;loadIM.prototype.getListRooms=getListRooms;loadIM.prototype.get IsIE=getIsIE;loadIM.prototype.getPhotoUser=getPhotoUser;loadIM.prototype.getSmiles=getSmiles;loadIM.prototype.getStatusUserIM=getStatusUserIM;loadIM.prototype.getStatusMessage=getStatusMessage;loadIM.prototype.getShowContactsOffline=getShowContactsOffline;loadIM.prototype.getUserCurrent=getUserCurrent;loadIM.prototype.getZIndex=getZindex;loadIM.prototype.groupsHidden=groupsHidden;loadIM.prototype.groupsVisible=groupsVisible;loadIM.prototype.joinRoom=joinRoom;loadIM.prototype.keyPressSearch=keyPressSearch;loadIM.prototype.listRooms=listRooms;loadIM.prototype.loginPage=loginPage;loadIM.prototype.notification=notificationNewMessage;loadIM.prototype.parse=parse;loadIM.prototype.preferences=preferences;loadIM.prototype.searchUser=searchUser326 loadIM.prototype.adIcon=addIcon;loadIM.prototype.actionButton=actionButton;loadIM.prototype.addContact=addContact;loadIM.prototype.addNewUser=addNewUser;loadIM.prototype.clrAllContacts=clrAllContacts;loadIM.prototype.configEvents=configEvents;loadIM.prototype.createChatRooms=createChatRooms;loadIM.prototype.disabledNotificationNewUsers=disabledNotificationNewUsers;loadIM.prototype.enabledNotificationNewUsers=enabledNotificationNewUsers;loadIM.prototype.getListRooms=getListRooms;loadIM.prototype.getBrowserCompatible=getBrowserCompatible;loadIM.prototype.getPhotoUser=getPhotoUser;loadIM.prototype.getSmiles=getSmiles;loadIM.prototype.getStatusUserIM=getStatusUserIM;loadIM.prototype.getStatusMessage=getStatusMessage;loadIM.prototype.getShowContactsOffline=getShowContactsOffline;loadIM.prototype.getUserCurrent=getUserCurrent;loadIM.prototype.getZIndex=getZindex;loadIM.prototype.groupsHidden=groupsHidden;loadIM.prototype.groupsVisible=groupsVisible;loadIM.prototype.joinRoom=joinRoom;loadIM.prototype.keyPressSearch=keyPressSearch;loadIM.prototype.listRooms=listRooms;loadIM.prototype.loginPage=loginPage;loadIM.prototype.notification=notificationNewMessage;loadIM.prototype.parse=parse;loadIM.prototype.preferences=preferences;loadIM.prototype.searchUser=searchUser 327 327 loadIM.prototype.setAutorization=setAutorization;loadIM.prototype.setMessageStatus=setMessageStatus;loadIM.prototype.setPreferences=setPreferences;loadIM.prototype.setPresence=setPresence;loadIM.prototype.setStatusJabber=setStatusJabber;loadIM.prototype.setSelectEditable=setSelectEditable;loadIM.prototype.setUserCurrent=setUserCurrent;loadIM.prototype.removeContact=removeContact;loadIM.prototype.removeElement=removeElement;loadIM.prototype.removeGroup=removeGroup;loadIM.prototype.renameContact=renameContact;loadIM.prototype.renameGroup=renameGroup;loadIM.prototype.rosterDiv=rosterDiv;loadIM.prototype.windowNotificationNewUsers=windowNotificationNewUsers;loadIM.prototype.windowPOPUP=windowPOPUP;window.LoadIM=loadIM;if(SnifferBrowser.isCompatible('is_ie')) 328 328 {configEvents(window,'onload',function() -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/jmessenger/js/strophe.mini.js
r3317 r4644 109 109 {var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();if(xhr.overrideMimeType){xhr.overrideMimeType("text/xml");}}else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");} 110 110 xhr.onreadystatechange=this.func.prependArg(this);return xhr;}};Strophe.Connection=function(service) 111 {this.service=service;this.jid="";this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this._idleTimeout=null;this._disconnectTimeout=null;this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this.paused=false;this.hold= 1;this.wait=60;this.window=5;this._data=[];this._requests=[];this._uniqueId=Math.round(Math.random()*10000);this._sasl_success_handler=null;this._sasl_failure_handler=null;this._sasl_challenge_handler=null;this._idleTimeout=setTimeout(this._onIdle.bind(this),100);for(var k in Strophe._connectionPlugins){if(Strophe._connectionPlugins.hasOwnProperty(k)){var ptype=Strophe._connectionPlugins[k];var F=function(){};F.prototype=ptype;this[k]=new F();this[k].init(this);}}};Strophe.Connection.prototype={reset:function()111 {this.service=service;this.jid="";this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this._idleTimeout=null;this._disconnectTimeout=null;this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this.paused=false;this.hold=2;this.wait=20;this.window=5;this._data=[];this._requests=[];this._uniqueId=Math.round(Math.random()*10000);this._sasl_success_handler=null;this._sasl_failure_handler=null;this._sasl_challenge_handler=null;this._idleTimeout=setTimeout(this._onIdle.bind(this),100);for(var k in Strophe._connectionPlugins){if(Strophe._connectionPlugins.hasOwnProperty(k)){var ptype=Strophe._connectionPlugins[k];var F=function(){};F.prototype=ptype;this[k]=new F();this[k].init(this);}}};Strophe.Connection.prototype={reset:function() 112 112 {this.rid=Math.floor(Math.random()*4294967295);this.sid=null;this.streamId=null;this.do_session=false;this.do_bind=false;this.timedHandlers=[];this.handlers=[];this.removeTimeds=[];this.removeHandlers=[];this.addTimeds=[];this.addHandlers=[];this.authenticated=false;this.disconnecting=false;this.connected=false;this.errors=0;this._requests=[];this._uniqueId=Math.round(Math.random()*10000);},pause:function() 113 113 {this.paused=true;},resume:function() -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/jmessenger/js/trophyim.js
r4420 r4644 17 17 this.processor = new XSLTProcessor(); 18 18 this.processor.importStylesheet(this.xmlRender( 19 '<xsl:stylesheet version="1.0"\19 '<xsl:stylesheet version="1.0"\ 20 20 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\ 21 21 <xsl:output method="html" indent="yes"/><xsl:template\ … … 68 68 } 69 69 var renderObj = this.parser.parseFromString(xmlString, 70 "application/xml");70 "application/xml"); 71 71 } catch(e) { 72 72 alert("TrophyIM Error: Cannot create new html for page"); … … 84 84 */ 85 85 getHTML : function(page) 86 86 { 87 87 return this.xmlParse(HTMLSnippets[page]); 88 88 }, … … 96 96 */ 97 97 getScript : function(script) 98 98 { 99 99 var newscript = document.createElement('script'); 100 100 newscript.setAttribute('src', script); … … 112 112 113 113 114 controll : {notificationNewUsers : 0}, 115 116 /** AutoConnection 114 controll : { 115 notificationNewUsers : 0 116 }, 117 118 /** AutoConnection 117 119 * 118 120 */ 119 121 120 autoConnection : {connect : true}, 121 122 /** Active Chat Room 122 autoConnection : { 123 connect : true 124 }, 125 126 /** Active Chat Room 123 127 * 124 128 */ 125 129 126 activeChatRoom : {name : []}, 127 128 /** Object: chatHistory 130 activeChatRoom : { 131 name : [] 132 }, 133 134 /** Object: chatHistory 129 135 * 130 136 * Stores chat history (last 10 message) and current presence of active … … 132 138 */ 133 139 134 135 136 140 chatHistory : {}, 141 142 /** Constants: 137 143 * 138 144 * (Boolean) stale_roster - roster is stale and needs to be rewritten. 139 145 */ 140 146 141 constants : {stale_roster: false}, 142 143 /** PosWindow 147 constants : { 148 stale_roster: false 149 }, 150 151 /** PosWindow 144 152 * 145 153 */ 146 posWindow : {left : 400, top : 100}, 147 148 /** StatusConnection 154 posWindow : { 155 left : 400, 156 top : 100 157 }, 158 159 /** StatusConnection 149 160 * 150 161 */ 151 162 152 statusConn : {connected : false}, 153 154 /** TimeOut Render Roster 163 statusConn : { 164 connected : false 165 }, 166 167 /** TimeOut Render Roster 155 168 * 156 169 * 157 170 */ 158 171 159 _timeOut : {renderRoster : null}, 160 161 162 /** Remove Contact ( type = set ) 172 _timeOut : { 173 renderRoster : null 174 }, 175 176 177 /** Remove Contact ( type = set ) 163 178 * 164 179 * 165 180 */ 166 181 167 removeResult : {idResult : []}, 168 169 /** Function: setCookie 182 removeResult : { 183 idResult : [] 184 }, 185 186 /** Function: setCookie 170 187 * 171 188 * Sets cookie name/value pair. Date and path are auto-selected. … … 176 193 */ 177 194 178 179 195 setCookie : function(name, value) 196 { 180 197 var expire = new Date(); 181 198 expire.setDate(expire.getDate() + 365); … … 183 200 }, 184 201 185 202 /** Function: delCookie 186 203 * 187 204 * Deletes cookie … … 191 208 */ 192 209 193 194 210 delCookie : function(name) 211 { 195 212 var expire = new Date(); 196 213 expire.setDate(expire.getDate() - 365); … … 199 216 }, 200 217 201 218 /** Function: getCookies 202 219 * 203 220 * Retrieves all trophyim cookies into an indexed object. Inteneded to be … … 208 225 */ 209 226 210 211 227 getCookies : function() 228 { 212 229 var cObj = {}; 213 230 var cookies = document.cookie.split(';'); … … 215 232 for(var i = 0 ; i < cookies.length; i++ ) 216 233 { 217 234 while ( cookies[i].charAt(0) == ' ') 218 235 { 219 236 cookies[i] = cookies[i].substring(1,cookies[i].length); … … 237 254 */ 238 255 239 240 241 242 { 243 256 load : function() 257 { 258 if( loadscript.getUserCurrent() == null ) 259 { 260 loadscript.setUserCurrent(); 244 261 } 245 262 246 247 248 249 250 251 252 253 254 255 256 257 },258 259 /** Function: storeData263 if ( !TrophyIM.statusConn.connected ) 264 { 265 TrophyIM.cookies = TrophyIM.getCookies(); 266 267 //Wait a second to give scripts time to load 268 setTimeout( "TrophyIM.showLogin()", 550 ); 269 } 270 else 271 { 272 loadscript.rosterDiv(); 273 } 274 }, 275 276 /** Function: storeData 260 277 * 261 278 * Store all our data in the JSONStore, if it is active 262 279 */ 263 280 264 storeData : function()265 {281 storeData : function() 282 { 266 283 if ( TrophyIM.connection && TrophyIM.connection.connected ) 267 284 { 268 285 TrophyIM.setCookie('trophyim_bosh_xid', TrophyIM.connection.jid + "|" + 269 TrophyIM.connection.sid + "|" + TrophyIM.connection.rid);286 TrophyIM.connection.sid + "|" + TrophyIM.connection.rid); 270 287 TrophyIM.rosterObj.save(); 271 288 } … … 280 297 281 298 showLogin : function() 282 299 { 283 300 /** 284 301 * … … 288 305 */ 289 306 290 291 { 292 307 if ( typeof(JSON) != undefined && typeof(Strophe) != undefined ) 308 { 309 TrophyIM.JSONStore = new TrophyIMJSONStore(); 293 310 294 295 { 296 311 if ( TrophyIM.JSONStore.store_working && TrophyIM.cookies['trophyim_bosh_xid'] ) 312 { 313 var xids = TrophyIM.cookies['trophyim_bosh_xid'].split("|"); 297 314 TrophyIM.delCookie('trophyim_bosh_xid'); 298 315 TrophyIM.constants.stale_roster = true; 299 316 300 317 TrophyIM.connection = new Strophe.Connection(TROPHYIM_BOSH_SERVICE); 301 318 TrophyIM.connection.rawInput = TrophyIM.rawInput; 302 319 TrophyIM.connection.rawOutput = TrophyIM.rawOutput; … … 308 325 else 309 326 { 310 311 312 313 314 315 327 // List Contact 328 loadscript.rosterDiv(); 329 330 // Get User Current; 331 var _getUserCurrent = null; 332 _getUserCurrent = loadscript.getUserCurrent(); 316 333 317 318 319 320 321 322 323 324 334 if( _getUserCurrent == null ) 335 { 336 setTimeout( "TrophyIM.showLogin()", 500 ); 337 } 338 else 339 { 340 TrophyIM.login( Base64.decode( _getUserCurrent.jid ), Base64.decode( _getUserCurrent.password )); 341 } 325 342 } 326 343 } 327 344 else 328 345 { 329 330 } 331 }, 332 333 346 setTimeout("TrophyIM.showLogin()", 500); 347 } 348 }, 349 350 /** Function: log 334 351 * 335 352 * This function logs the given message in the trophyimlog div … … 361 378 */ 362 379 rawInput : function (data) 363 380 { 364 381 Strophe.debug("RECV: " + data); 365 382 }, … … 370 387 */ 371 388 rawOutput : function (data) 372 389 { 373 390 Strophe.debug("SEND: " + data); 374 391 }, … … 382 399 */ 383 400 login : function() 384 385 386 387 401 { 402 if ( TrophyIM.JSONStore.store_working ) 403 { 404 //In case they never logged out 388 405 TrophyIM.JSONStore.delData(['groups','roster', 'active_chat', 'chat_history']); 389 406 } 390 407 391 408 TrophyIM.connection = new Strophe.Connection(TROPHYIM_BOSH_SERVICE); 392 409 TrophyIM.connection.rawInput = TrophyIM.rawInput; 393 410 TrophyIM.connection.rawOutput = TrophyIM.rawOutput; 394 411 //Strophe.log = TrophyIM.log; 395 412 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 413 if ( arguments.length > 0 ) 414 { 415 var barejid = arguments[0]; 416 var password = arguments[1]; 417 418 TrophyIM.connection.connect( barejid + TROPHYIM_RESOURCE, password, TrophyIM.onConnect ); 419 } 420 else 421 { 422 423 var barejid = document.getElementById('trophyimjid').value 424 var fulljid = barejid + TROPHYIM_RESOURCE; 425 var password = document.getElementById('trophyimpass').value; 426 var button = document.getElementById('trophyimconnect'); 427 428 loadscript.setUserCurrent( barejid, password); 429 430 if ( button.value == 'connect' ) 431 { 432 button.value = 'disconnect'; 433 //TrophyIM.connection.connect( fulljid , password, TrophyIM.onConnect ); 417 434 418 419 420 421 422 423 435 TrophyIM.login( barejid, password ); 436 _winBuild('window_login_page', 'remove'); 437 } 438 } 439 440 TrophyIM.setCookie('trophyimjid', barejid); 424 441 }, 425 442 … … 429 446 */ 430 447 logout : function() 431 432 448 { 449 TrophyIM.autoConnection.connect = false; 433 450 434 451 TrophyIM.delCookie('trophyim_bosh_xid'); 435 452 436 453 delete TrophyIM['cookies']['trophyim_bosh_xid']; … … 444 461 */ 445 462 onConnect : function(status) 446 447 448 449 450 451 452 453 } 454 455 456 457 463 { 464 var loading_gif = document.getElementById("JabberIMRosterLoadingGif"); 465 466 if( status == Strophe.Status.CONNECTING ) 467 { 468 loading_gif.style.display = "block"; 469 Strophe.info('Strophe is connecting.'); 470 } 471 472 if( status == Strophe.Status.CONNFAIL ) 473 { 474 TrophyIM.delCookie('trophyim_bosh_xid'); 458 475 TrophyIM.statusConn.connected = false; 459 476 loading_gif.style.display = "block"; 460 477 } 461 478 462 463 464 465 } 466 467 468 469 470 471 479 if( status == Strophe.Status.DISCONNECTING ) 480 { 481 TrophyIM.statusConn.connected = false; 482 } 483 484 if( status == Strophe.Status.DISCONNECTED ) 485 { 486 if( TrophyIM.autoConnection.connect ) 487 { 488 loading_gif.style.display = "block"; 472 489 473 490 TrophyIM.delCookie('trophyim_bosh_xid'); 474 491 475 492 TrophyIM.statusConn.connected = false; 476 493 477 478 479 494 setTimeout(function() 495 { 496 TrophyIM.showLogin(); 480 497 481 498 },10000); 482 499 483 500 loadscript.clrAllContacts(); 484 501 485 502 loadscript.setStatusJabber(i18n.STATUS_ANAVAILABLE,"unavailable"); 486 503 487 488 489 490 } 491 492 493 494 495 504 delete TrophyIM.rosterObj.roster; 505 delete TrophyIM.rosterObj.groups; 506 } 507 } 508 509 if( status == Strophe.Status.CONNECTED ) 510 { 511 loadscript.setStatusJabber(i18n.STATUS_AVAILABLE,'available'); 512 TrophyIM.statusConn.connected = true; 496 513 TrophyIM.showClient(); 497 514 } … … 504 521 */ 505 522 showClient : function() 506 523 { 507 524 TrophyIM.setCookie('trophyim_bosh_xid', TrophyIM.connection.jid + "|" + 508 TrophyIM.connection.sid + "|" + TrophyIM.connection.rid);525 TrophyIM.connection.sid + "|" + TrophyIM.connection.rid); 509 526 510 527 TrophyIM.rosterObj = new TrophyIMRoster(); … … 514 531 TrophyIM.connection.addHandler(TrophyIM.onMessage, null, 'message', null, null, null); 515 532 516 //Get roster then announce presence. 517 TrophyIM.connection.send($iq({type: 'get', xmlns: Strophe.NS.CLIENT}).c('query', {xmlns: Strophe.NS.ROSTER}).tree()); 533 //Get roster then announce presence. 534 TrophyIM.connection.send($iq({ 535 type: 'get', 536 xmlns: Strophe.NS.CLIENT 537 }).c('query', { 538 xmlns: Strophe.NS.ROSTER 539 }).tree()); 518 540 TrophyIM.connection.send($pres().tree()); 519 541 setTimeout( TrophyIM.renderRoster, 1000); 520 542 }, 521 543 … … 558 580 var to = msg.getAttribute('to'); 559 581 var id = msg.getAttribute('id'); 560 var reply = $iq({type: 'result', to: from, from: to, id: id}).c('query', 561 {name: "TrophyIM", version: TROPHYIM_VERSION, os: 562 "Javascript-capable browser"}); 582 var reply = $iq({ 583 type: 'result', 584 to: from, 585 from: to, 586 id: id 587 }).c('query', 588 589 { 590 name: "TrophyIM", 591 version: TROPHYIM_VERSION, 592 os: 593 "Javascript-capable browser" 594 }); 563 595 TrophyIM.connection.send(reply.tree()); 564 596 } … … 572 604 573 605 onRoster : function(msg) 574 575 576 577 578 579 580 581 582 606 { 607 var roster_items = msg.firstChild.getElementsByTagName('item'); 608 609 for (var i = 0; i < roster_items.length; i++) 610 { 611 with(roster_items[i]) 612 { 613 var groups = getElementsByTagName('group'); 614 var group_array = []; 583 615 584 585 586 587 588 589 590 591 592 593 594 595 616 for( var g = 0 ; g < groups.length; g++ ) 617 { 618 if( groups[g].hasChildNodes() ) 619 group_array[group_array.length] = groups[g].firstChild.nodeValue; 620 } 621 622 if( getAttribute('ask') && getAttribute('ask').toString() === "subscribe" ) 623 { 624 if( getAttribute('subscription').toString() === "none" ) 625 { 626 TrophyIM.rosterObj.addContact( getAttribute('jid'), getAttribute('ask'), getAttribute('name'), group_array ); 627 } 596 628 597 if( getAttribute('subscription').toString() === "remove" ) 598 { 599 TrophyIM.rosterObj.removeContact( getAttribute('jid').toString() ); 600 } 601 } 602 else 603 { 604 if( ( getAttribute('ask') == null && getAttribute('subscription').toString() === "remove" ) || getAttribute('subscription').toString() === "remove" ) 605 { 606 TrophyIM.rosterObj.removeContact( getAttribute('jid').toString() ); 607 } 608 else 609 { 610 TrophyIM.rosterObj.addContact( getAttribute('jid'), getAttribute('subscription'), getAttribute('name'), group_array ); 611 } 612 } 613 } 614 } 615 616 if ( msg.getAttribute('type') == 'set' ) 617 { 618 var _iq = $iq({type: 'reply', id: msg.getAttribute('id'), to: msg.getAttribute('from')}); 619 TrophyIM.connection.send( _iq.tree()); 620 } 621 622 return true; 629 if( getAttribute('subscription').toString() === "remove" ) 630 { 631 TrophyIM.rosterObj.removeContact( getAttribute('jid').toString() ); 632 } 633 } 634 else 635 { 636 if( ( getAttribute('ask') == null && getAttribute('subscription').toString() === "remove" ) || getAttribute('subscription').toString() === "remove" ) 637 { 638 TrophyIM.rosterObj.removeContact( getAttribute('jid').toString() ); 639 } 640 else 641 { 642 TrophyIM.rosterObj.addContact( getAttribute('jid'), getAttribute('subscription'), getAttribute('name'), group_array ); 643 } 644 } 645 } 646 } 647 648 if ( msg.getAttribute('type') == 'set' ) 649 { 650 var _iq = $iq({ 651 type: 'reply', 652 id: msg.getAttribute('id'), 653 to: msg.getAttribute('from') 654 }); 655 TrophyIM.connection.send( _iq.tree()); 656 } 657 658 return true; 623 659 }, 624 660 … … 629 665 630 666 onPresence : function(msg) 631 632 633 634 635 667 { 668 // Get Presences ChatRoom 669 TrophyIM.onPresenceChatRoom( msg ); 670 671 var type = msg.getAttribute('type') ? msg.getAttribute('type') : 'available'; 636 672 var show = msg.getElementsByTagName('show').length ? Strophe.getText(msg.getElementsByTagName('show')[0]) : type; 637 673 var status = msg.getElementsByTagName('status').length ? Strophe.getText(msg.getElementsByTagName('status')[0]) : ''; 638 674 var priority = msg.getElementsByTagName('priority').length ? parseInt(Strophe.getText(msg.getElementsByTagName('priority')[0])) : 0; 639 675 640 641 642 643 644 645 646 647 648 649 650 651 676 if( msg.getAttribute('from').toString().indexOf( TROPHYIM_CHATROOM ) < 0 ) 677 { 678 var _from = Strophe.getBareJidFromJid( msg.getAttribute('from') ); 679 var _flag = true; 680 681 if( TrophyIM.removeResult.idResult.length > 0 ) 682 { 683 for( var i = 0 ; i < TrophyIM.removeResult.idResult.length; i++ ) 684 { 685 if( TrophyIM.removeResult.idResult[i] == _from ) 686 { 687 _flag = false; 652 688 653 689 TrophyIM.removeResult.idResult.splice(i,1); 654 690 655 691 i--; 656 692 657 658 659 660 661 693 if( show.toLowerCase() === 'subscribe' ) 694 _flag = true; 695 } 696 } 697 } 662 698 663 664 665 } 666 667 699 if( _flag ) 700 TrophyIM.rosterObj.setPresence( msg.getAttribute('from'), priority, show, status ); 701 } 702 703 return true; 668 704 }, 669 705 … … 717 753 if( xmlns.indexOf("http://jabber.org/protocol/muc#user") == 0 ) 718 754 { 719 var _from = xquery[i].parentNode.getAttribute('from'); 720 var _to = xquery[i].parentNode.getAttribute('to'); 721 722 // Get NameChatRoom 723 var nameChatRoom = Strophe.getBareJidFromJid( _from ); 724 725 // Get nickName 726 var nickName = Strophe.getResourceFromJid( _from ); 727 728 // Get Type/Show 729 var type = ( xquery[i].parentNode.getAttribute('type') != null ) ? xquery[i].parentNode.getAttribute('type') : 'available' ; 730 var show = ( xquery[i].parentNode.firstChild.nodeName == "show" ) ? xquery[i].parentNode.firstChild.firstChild.nodeValue : type; 731 732 var _idElement = nameChatRoom + "_UserChatRoom__" + nickName; 733 734 var _UserChatRoom = document.createElement("div"); 735 _UserChatRoom.id = _idElement; 736 _UserChatRoom.style.paddingLeft = '18px'; 737 _UserChatRoom.style.margin = '3px 0px 0px 2px'; 738 _UserChatRoom.style.background = 'url("'+path_jabberit+'templates/default/images/' + show + '.gif") no-repeat center left'; 739 _UserChatRoom.appendChild( document.createTextNode( nickName ) ); 740 741 var nodeUser = document.getElementById( _idElement ); 742 743 if( nodeUser == null ) 755 var _from = xquery[i].parentNode.getAttribute('from'); 756 var _to = xquery[i].parentNode.getAttribute('to'); 757 758 // Get NameChatRoom 759 var nameChatRoom = Strophe.getBareJidFromJid( _from ); 760 761 // Get nickName 762 var nickName = Strophe.getResourceFromJid( _from ); 763 764 // Get Type/Show 765 var type = ( xquery[i].parentNode.getAttribute('type') != null ) ? xquery[i].parentNode.getAttribute('type') : 'available' ; 766 var show = ( xquery[i].parentNode.firstChild.nodeName == "show" ) ? xquery[i].parentNode.firstChild.firstChild.nodeValue : type; 767 768 var _idElement = nameChatRoom + "_UserChatRoom__" + nickName; 769 770 var _UserChatRoom = document.createElement("div"); 771 _UserChatRoom.id = _idElement; 772 _UserChatRoom.style.paddingLeft = '18px'; 773 _UserChatRoom.style.margin = '3px 0px 0px 2px'; 774 _UserChatRoom.style.background = 'url("'+path_jabberit+'templates/default/images/' + show + '.gif") no-repeat center left'; 775 _UserChatRoom.appendChild( document.createTextNode( nickName ) ); 776 777 var nodeUser = document.getElementById( _idElement ); 778 779 if( nodeUser == null ) 780 { 781 if( document.getElementById( nameChatRoom + '__roomChat__participants' ) != null ) 744 782 { 745 if( document.getElementById( nameChatRoom + '__roomChat__participants' ) != null ) 746 { 747 nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' ); 748 nameChatRoom.appendChild( _UserChatRoom ); 749 } 750 else 751 { 752 if( type != 'unavailable' ) 753 { 754 TrophyIM.makeChatRoom( nameChatRoom, nameChatRoom.substring(0, nameChatRoom.indexOf('@'))); 755 nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' ); 756 nameChatRoom.appendChild( _UserChatRoom ); 757 } 758 } 783 nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' ); 784 nameChatRoom.appendChild( _UserChatRoom ); 759 785 } 760 786 else 761 787 { 762 if( type == 'unavailable' ) 763 { 764 nodeUser.parentNode.removeChild( nodeUser ); 765 } 766 else if( show ) 767 { 768 nodeUser.style.backgroundImage = 'url("'+path_jabberit+'templates/default/images/' + show + '.gif")'; 769 } 788 if( type != 'unavailable' ) 789 { 790 TrophyIM.makeChatRoom( nameChatRoom, nameChatRoom.substring(0, nameChatRoom.indexOf('@'))); 791 nameChatRoom = document.getElementById( nameChatRoom + '__roomChat__participants' ); 792 nameChatRoom.appendChild( _UserChatRoom ); 793 } 770 794 } 795 } 796 else 797 { 798 if( type == 'unavailable' ) 799 { 800 nodeUser.parentNode.removeChild( nodeUser ); 801 } 802 else if( show ) 803 { 804 nodeUser.style.backgroundImage = 'url("'+path_jabberit+'templates/default/images/' + show + '.gif")'; 805 } 806 } 771 807 } 772 808 } … … 782 818 onMessage : function(msg) 783 819 { 784 785 786 820 var checkTime = function(i) 821 { 822 if ( i < 10 ) i= "0" + i; 787 823 788 789 824 return i; 825 }; 790 826 791 792 793 794 795 796 797 798 799 800 801 802 827 var messageDate = function( _date ) 828 { 829 var _dt = _date.substr( 0, _date.indexOf( 'T' ) ).split( '-' ); 830 var _hr = _date.substr( _date.indexOf( 'T' ) + 1, _date.length - _date.indexOf( 'T' ) - 2 ).split( ':' ); 831 832 ( _date = new Date ).setTime( Date.UTC( _dt[0], _dt[1] - 1, _dt[2], _hr[0], _hr[1], _hr[2] ) ); 833 834 return ( _date.toLocaleDateString( ).replace( /-/g, '/' ) + ' ' + _date.toLocaleTimeString( ) ); 835 }; 836 837 var data = new Date(); 838 var dtNow = checkTime(data.getHours()) + ":" + checkTime(data.getMinutes()) + ":" + checkTime(data.getSeconds()); 803 839 804 840 var from = msg.getAttribute('from'); … … 808 844 var stamp = ( delay[0] != null ) ? "<font style='color:red;'>" + messageDate(delay[0].getAttribute('stamp')) + "</font>" : dtNow; 809 845 810 811 812 813 814 815 816 817 818 819 820 821 846 var barejid = Strophe.getBareJidFromJid(from); 847 var jidChatRoom = Strophe.getResourceFromJid(from); 848 var jid_lower = barejid.toLowerCase(); 849 var contact = ""; 850 var state = ""; 851 852 var chatBox = document.getElementById(jid_lower + "__chatState"); 853 var chatStateOnOff = null; 854 var active = msg.getElementsByTagName('active'); 855 856 contact = barejid.toLowerCase(); 857 contact = contact.substring(0, contact.indexOf('@')); 822 858 823 if( TrophyIM.rosterObj.roster[barejid] ) 824 { 825 if( TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name'] ) 826 { 827 contact = TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name']; 828 } 829 } 830 831 // Message with body are "content message", this means state active 832 if ( elems.length > 0 ) 833 { 834 state = ""; 835 836 // Set notify chat state capability on when sender notify it themself 837 chatStateOnOff = document.getElementById(jid_lower + "__chatStateOnOff"); 838 839 if (active.length > 0 & chatStateOnOff != null ) 840 { 841 chatStateOnOff.value = 'on'; 842 } 843 844 // Get Message 845 var _message = document.createElement("div"); 846 var _text = Strophe.getText( elems[0] ); 847 848 // Events Javascript 849 _text = _text.replace(/onblur/gi,"EVENT_DENY"); 850 851 _text = _text.replace(/onchange/gi,"EVENT_DENY"); 852 853 _text = _text.replace(/onclick/gi,"EVENT_DENY"); 854 855 _text = _text.replace(/ondblclick/gi,"EVENT_DENY"); 856 857 _text = _text.replace(/onerror/gi,"EVENT_DENY"); 858 859 _text = _text.replace(/onfocus/gi,"EVENT_DENY"); 860 861 _text = _text.replace(/onkeydown/gi,"EVENT_DENY"); 862 863 _text = _text.replace(/onkeypress/gi,"EVENT_DENY"); 864 865 _text = _text.replace(/onkeyup/gi,"EVENT_DENY"); 866 867 _text = _text.replace(/onmousedown/gi,"EVENT_DENY"); 868 869 _text = _text.replace(/onmousemove/gi,"EVENT_DENY"); 870 871 _text = _text.replace(/onmouseout/gi,"EVENT_DENY"); 872 873 _text = _text.replace(/onmouseover/gi,"EVENT_DENY"); 874 875 _text = _text.replace(/onmouseup/gi,"EVENT_DENY"); 876 877 _text = _text.replace(/onresize/gi,"EVENT_DENY"); 878 879 _text = _text.replace(/onselect/gi,"EVENT_DENY"); 880 881 _text = _text.replace(/onunload/gi,"EVENT_DENY"); 882 883 // Events CSS 884 _text = _text.replace(/style/gi,"EVENT_DENY"); 885 886 // Tags HTML 887 _text = _text.replace(/img /gi,"IMG_DENY "); 888 889 _text = _text.replace(/script /gi,"SCRIPT_DENY "); 890 891 _text = _text.replace(/div /gi,"DIV_DENY "); 892 893 _text = _text.replace(/span /gi,"SPAN_DENY "); 894 895 _text = _text.replace(/iframe /gi,"IFRAME_DENY "); 896 897 _message.innerHTML = _text; 898 899 ////////// BEGIN XSS ////////////////////////////////////////////////// 900 // Delete Tags <SCRIPT> 901 var scripts = _message.getElementsByTagName('script_deny'); 902 for (var i = 0; i < scripts.length; i++){_message.removeChild(scripts[i--]);} 903 //////////////////////////////////////////////////// 904 905 // Delete Tags <IMG> 906 var _imgSrc = _message.getElementsByTagName('img_deny'); 907 for (var i = 0; i < _imgSrc.length; i++){_imgSrc[i].parentNode.removeChild( _imgSrc[i--] );} 908 //////////////////////////////////////////////////// 909 910 // Delete Tags <DIV> 911 var _Div = _message.getElementsByTagName('div_deny'); 912 for (var i = 0; i < _Div.length; i++){_Div[i].parentNode.removeChild( _Div[i--] );} 913 //////////////////////////////////////////////////// 914 915 // Delete Tags <SPAN> 916 var _Span = _message.getElementsByTagName('span_deny'); 917 for (var i = 0; i < _Span.length; i++){_Span[i].parentNode.removeChild( _Span[i--] );} 918 //////////////////////////////////////////////////// 919 920 // Delete Tags <IFRAME> 921 var _Iframe = _message.getElementsByTagName('iframe_deny'); 922 for (var i = 0; i < _Iframe.length; i++){_Iframe[i].parentNode.removeChild( _Iframe[i--] );} 923 924 // Delete Tags <A HREF> 925 var _aHref = _message.getElementsByTagName('a'); 926 for (var i = 0; i < _aHref.length; i++){_aHref[i].parentNode.removeChild( _aHref[i--] );} 927 928 _message.innerHTML = _message.innerHTML.replace(/^\s+|\s+$|^\n|\n$/g, ""); 929 ////////// END XSS ////////////////////////////////////////////////// 930 931 // Get Smiles 932 _message.innerHTML = loadscript.getSmiles( _message.innerHTML ); 933 934 if (type == 'chat' || type == 'normal') 935 { 936 if ( _message.hasChildNodes() ) 937 { 938 var message = 939 { 940 contact : "[" + stamp + "] <font style='font-weight:bold; color:black;'>" + contact + "</font>", 941 msg : "</br>" + _message.innerHTML 942 }; 859 if( TrophyIM.rosterObj.roster[barejid] ) 860 { 861 if( TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name'] ) 862 { 863 contact = TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name']; 864 } 865 } 866 867 // Message with body are "content message", this means state active 868 if ( elems.length > 0 ) 869 { 870 state = ""; 871 872 // Set notify chat state capability on when sender notify it themself 873 chatStateOnOff = document.getElementById(jid_lower + "__chatStateOnOff"); 874 875 if (active.length > 0 & chatStateOnOff != null ) 876 { 877 chatStateOnOff.value = 'on'; 878 } 879 880 // Get Message 881 var _message = document.createElement("div"); 882 var _text = Strophe.getText( elems[0] ); 883 884 // Events Javascript 885 _text = _text.replace(/onblur/gi,"EVENT_DENY"); 886 887 _text = _text.replace(/onchange/gi,"EVENT_DENY"); 888 889 _text = _text.replace(/onclick/gi,"EVENT_DENY"); 890 891 _text = _text.replace(/ondblclick/gi,"EVENT_DENY"); 892 893 _text = _text.replace(/onerror/gi,"EVENT_DENY"); 894 895 _text = _text.replace(/onfocus/gi,"EVENT_DENY"); 896 897 _text = _text.replace(/onkeydown/gi,"EVENT_DENY"); 898 899 _text = _text.replace(/onkeypress/gi,"EVENT_DENY"); 900 901 _text = _text.replace(/onkeyup/gi,"EVENT_DENY"); 902 903 _text = _text.replace(/onmousedown/gi,"EVENT_DENY"); 904 905 _text = _text.replace(/onmousemove/gi,"EVENT_DENY"); 906 907 _text = _text.replace(/onmouseout/gi,"EVENT_DENY"); 908 909 _text = _text.replace(/onmouseover/gi,"EVENT_DENY"); 910 911 _text = _text.replace(/onmouseup/gi,"EVENT_DENY"); 912 913 _text = _text.replace(/onresize/gi,"EVENT_DENY"); 914 915 _text = _text.replace(/onselect/gi,"EVENT_DENY"); 916 917 _text = _text.replace(/onunload/gi,"EVENT_DENY"); 918 919 // Events CSS 920 _text = _text.replace(/style/gi,"EVENT_DENY"); 921 922 // Tags HTML 923 _text = _text.replace(/img /gi,"IMG_DENY "); 924 925 _text = _text.replace(/script /gi,"SCRIPT_DENY "); 926 927 _text = _text.replace(/div /gi,"DIV_DENY "); 928 929 _text = _text.replace(/span /gi,"SPAN_DENY "); 930 931 _text = _text.replace(/iframe /gi,"IFRAME_DENY "); 932 933 _message.innerHTML = _text; 934 935 ////////// BEGIN XSS ////////////////////////////////////////////////// 936 // Delete Tags <SCRIPT> 937 var scripts = _message.getElementsByTagName('script_deny'); 938 for (var i = 0; i < scripts.length; i++){ 939 _message.removeChild(scripts[i--]); 940 } 941 //////////////////////////////////////////////////// 942 943 // Delete Tags <IMG> 944 var _imgSrc = _message.getElementsByTagName('img_deny'); 945 for (var i = 0; i < _imgSrc.length; i++){ 946 _imgSrc[i].parentNode.removeChild( _imgSrc[i--] ); 947 } 948 //////////////////////////////////////////////////// 949 950 // Delete Tags <DIV> 951 var _Div = _message.getElementsByTagName('div_deny'); 952 for (var i = 0; i < _Div.length; i++){ 953 _Div[i].parentNode.removeChild( _Div[i--] ); 954 } 955 //////////////////////////////////////////////////// 956 957 // Delete Tags <SPAN> 958 var _Span = _message.getElementsByTagName('span_deny'); 959 for (var i = 0; i < _Span.length; i++){ 960 _Span[i].parentNode.removeChild( _Span[i--] ); 961 } 962 //////////////////////////////////////////////////// 963 964 // Delete Tags <IFRAME> 965 var _Iframe = _message.getElementsByTagName('iframe_deny'); 966 for (var i = 0; i < _Iframe.length; i++){ 967 _Iframe[i].parentNode.removeChild( _Iframe[i--] ); 968 } 969 970 // Delete Tags <A HREF> 971 var _aHref = _message.getElementsByTagName('a'); 972 for (var i = 0; i < _aHref.length; i++){ 973 _aHref[i].parentNode.removeChild( _aHref[i--] ); 974 } 975 976 _message.innerHTML = _message.innerHTML.replace(/^\s+|\s+$|^\n|\n$/g, ""); 977 ////////// END XSS ////////////////////////////////////////////////// 978 979 // Get Smiles 980 _message.innerHTML = loadscript.getSmiles( _message.innerHTML ); 981 982 if (type == 'chat' || type == 'normal') 983 { 984 if ( _message.hasChildNodes() ) 985 { 986 var message = 987 { 988 contact : "[" + stamp + "] <font style='font-weight:bold; color:black;'>" + contact + "</font>", 989 msg : "</br>" + _message.innerHTML 990 }; 943 991 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 992 TrophyIM.addMessage( TrophyIM.makeChat( from ), jid_lower, message ); 993 } 994 } 995 else if( type == 'groupchat') 996 { 997 if ( _message.hasChildNodes() ) 998 { 999 var message = 1000 { 1001 contact : "[" + stamp + "] <font style='font-weight:bold; color:black;'>" + jidChatRoom + "</font>", 1002 msg : "</br>" + _message.innerHTML 1003 }; 1004 1005 TrophyIM.addMessage( TrophyIM.makeChatRoom( barejid ), jid_lower, message ); 1006 } 1007 } 1008 } 1009 // Message without body are "content message", this mean state is not active 1010 else 1011 { 1012 if( chatBox != null ) 1013 state = TrophyIM.getChatState(msg); 1014 } 1015 1016 // Clean chat status message some time later 1017 var clearChatState = function() 1018 { 1019 chatBox.innerHTML=''; 1020 } 1021 1022 if (chatBox != null) 1023 { 1024 var clearChatStateTimer; 1025 1026 chatBox.innerHTML = "<font style='font-weight:bold; color:grey; float:right;'>" + state + "</font>"; 1027 1028 var _composing = msg.getElementsByTagName('composing'); 1029 1030 if ( _composing.length == 0 ) 983 1031 984 985 986 987 988 989 990 991 992 1032 clearChatStateTimer = setTimeout(clearChatState, 2000); 1033 else 1034 clearTimeout(clearChatStateTimer); 1035 } 1036 1037 return true; 1038 }, 1039 1040 /** Function: getChatState 993 1041 * 994 1042 * Parameters: … … 996 1044 * (string) jid - the jid of chat box to update the chat state to. 997 1045 */ 998 999 1000 1046 getChatState : function(msg) 1047 { 1048 var state = msg.getElementsByTagName('inactive'); 1001 1049 1002 1003 1004 1005 1006 1007 1008 1050 if ( state.length > 0 ) 1051 { 1052 return i18n.INACTIVE; 1053 } 1054 else 1055 { 1056 state = msg.getElementsByTagName('gone'); 1009 1057 if ( state.length > 0 ) 1010 1058 { 1011 1012 1059 return i18n.GONE; 1060 } 1013 1061 else 1014 1062 { 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1063 state = msg.getElementsByTagName('composing'); 1064 if ( state.length > 0 ) 1065 { 1066 return i18n.COMPOSING; 1067 } 1068 else 1069 { 1070 state = msg.getElementsByTagName('paused'); 1071 if ( state.length > 0 ) 1072 { 1073 return i18n.PAUSED; 1074 } 1075 } 1076 } 1077 } 1078 1079 return ''; 1080 }, 1081 1082 /** Function: makeChat 1035 1083 * 1036 1084 * Make sure chat window to given fulljid exists, switching chat context to … … 1040 1088 makeChat : function(fulljid) 1041 1089 { 1042 1043 1044 1045 1046 1047 'enabledPopUp' : ( ( loadscript.getIsIE() ) ? "none" : "block" ),1048 1049 1050 1051 1052 1053 1054 1090 var barejid = Strophe.getBareJidFromJid(fulljid); 1091 var titleWindow = ""; 1092 1093 var paramsChatBox = 1094 { 1095 'enabledPopUp' : ( ( loadscript.getBrowserCompatible() ) ? "block" : "none" ), 1096 'idChatBox' : barejid + "__chatBox", 1097 'jidTo' : barejid, 1098 'path_jabberit' : path_jabberit 1099 }; 1100 1101 titleWindow = barejid.toLowerCase(); 1102 titleWindow = titleWindow.substring(0, titleWindow.indexOf('@')); 1055 1103 1056 1104 if( TrophyIM.rosterObj.roster[barejid] ) … … 1058 1106 if( TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name'] ) 1059 1107 { 1060 1108 titleWindow = TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name']; 1061 1109 } 1062 1110 } … … 1065 1113 TrophyIM.posWindow.top = TrophyIM.posWindow.top + 10; 1066 1114 if( TrophyIM.posWindow.top > 200 ) 1067 1115 TrophyIM.posWindow.top = 100; 1068 1116 1069 1117 // Position Left 1070 1118 TrophyIM.posWindow.left = TrophyIM.posWindow.left + 5; 1071 1119 if( TrophyIM.posWindow.left > 455 ) 1072 1120 TrophyIM.posWindow.left = 400; 1073 1121 1074 1122 var _content = document.createElement( 'div' ); … … 1079 1127 var _textarea = _content.getElementsByTagName( 'textarea' ).item( 0 ); 1080 1128 var _send = _content.getElementsByTagName( 'input' ).item( 0 ); 1081 1129 var _chatStateOnOff = _content.getElementsByTagName( 'input' ).item( 1 ); 1082 1130 1083 1131 var _send_message = function( ) 1084 1132 { 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1133 if ( ! TrophyIM.sendMessage( barejid, _textarea.value ) ) 1134 return false; 1135 1136 // Add Message in chatBox; 1137 TrophyIM.addMessage( _messages, barejid, { 1138 contact : "<font style='font-weight:bold; color:red;'>" + i18n.ME + "</font>", 1139 msg : "<br/>" + _textarea.value 1140 } ); 1141 1142 _textarea.value = ''; 1143 _textarea.focus( ); 1096 1144 }; 1097 1145 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1146 var composingTimer_ = 0; 1147 var isComposing_ = 0; 1148 var timeCounter; 1149 1150 var setComposing = function( ) 1151 { 1152 var checkComposing = function() 1153 { 1154 if (!isComposing_) { 1155 // User stopped composing 1156 composingTimer_ = 0; 1157 clearInterval(timeCounter); 1158 TrophyIM.sendContentMessage(barejid, 'paused'); 1159 } else { 1160 TrophyIM.sendContentMessage(barejid, 'composing'); 1161 } 1162 isComposing_ = 0; // Reset composing 1163 } 1164 1165 if (!composingTimer_) { 1166 /* User (re)starts composing */ 1167 composingTimer_ = 1; 1168 timeCounter = setInterval(checkComposing,4000); 1169 } 1170 isComposing_ = 1; 1171 }; 1124 1172 1125 1173 loadscript.configEvents( _send, 'onclick', _send_message ); 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 width: 387,1144 height: 375,1145 1146 left: TrophyIM.posWindow.left,1147 1148 1149 1150 zindex: loadscript.getZIndex(),1151 title: titleWindow,1152 closeAction: "hidden",1153 1154 1174 loadscript.configEvents( _textarea, 'onkeyup', function( e ) 1175 { 1176 if ( e.keyCode == 13 ){ 1177 _send_message( ); 1178 // User stopped composing 1179 composingTimer_ = 0; 1180 clearInterval(timeCounter); 1181 }else{ 1182 if (_chatStateOnOff.value == 'on') 1183 setComposing(); 1184 } 1185 } ); 1186 1187 var winChatBox = 1188 { 1189 id_window : "window_chat_area_" + barejid, 1190 barejid : barejid, 1191 width : 387, 1192 height : 375, 1193 top : TrophyIM.posWindow.top, 1194 left : TrophyIM.posWindow.left, 1195 draggable : true, 1196 visible : "display", 1197 resizable : true, 1198 zindex : loadscript.getZIndex(), 1199 title : titleWindow, 1200 closeAction : "hidden", 1201 content : _content 1202 } 1155 1203 1156 1157 1158 1159 1204 _win = _winBuild(winChatBox); 1205 1206 // Notification New Message 1207 loadscript.notification(barejid); 1160 1208 1161 1162 1209 // Photo User; 1210 loadscript.getPhotoUser(barejid); 1163 1211 1164 _textarea.focus( ); 1165 1166 return ( _messages = _win.content( ).firstChild ); 1167 }, 1168 1169 /** Function: makeChatRoom 1212 _textarea.focus( ); 1213 1214 _messages = _win.content( ).firstChild; 1215 1216 while ( _messages && _messages.nodeType !== 1 ) 1217 { 1218 _messages = _messages.nextSibling; 1219 } 1220 1221 return ( _messages ); 1222 }, 1223 1224 /** Function: makeChatRoom 1170 1225 * 1171 1226 * … … 1175 1230 makeChatRoom : function() 1176 1231 { 1177 1178 1232 var jidChatRoom = arguments[0]; 1233 var titleWindow = "ChatRoom - " + unescape(arguments[1]); 1179 1234 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1235 var paramsChatRoom = 1236 { 1237 'idChatRoom' : jidChatRoom + "__roomChat", 1238 'jidTo' : jidChatRoom, 1239 'lang_Send' : i18n.SEND, 1240 'lang_Leave_ChatRoom' : i18n.LEAVE_CHATROOM, 1241 'path_jabberit' : path_jabberit 1242 }; 1243 1244 // Position Top 1190 1245 TrophyIM.posWindow.top = TrophyIM.posWindow.top + 10; 1191 1246 if( TrophyIM.posWindow.top > 200 ) 1192 1247 TrophyIM.posWindow.top = 100; 1193 1248 1194 1249 // Position Left 1195 1250 TrophyIM.posWindow.left = TrophyIM.posWindow.left + 5; 1196 1251 if( TrophyIM.posWindow.left > 455 ) 1197 1252 TrophyIM.posWindow.left = 400; 1198 1253 1199 1254 var _content = document.createElement( 'div' ); … … 1208 1263 var _send_message = function( ) 1209 1264 { 1210 1211 1265 if ( ! TrophyIM.sendMessageChatRoom( jidChatRoom, _textarea.value ) ) 1266 return false; 1212 1267 1213 1268 _textarea.value = ''; 1214 1269 1215 1270 _textarea.focus( ); 1216 1271 }; 1217 1272 … … 1219 1274 loadscript.configEvents( _leaveChatRoom, 'onclick', function( ) 1220 1275 { 1221 1276 TrophyIM.leaveChatRoom( jidChatRoom ); 1222 1277 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1278 if( TrophyIM.activeChatRoom.name.length > 0 ) 1279 { 1280 for( var i = 0; i < TrophyIM.activeChatRoom.name.length ; i++ ) 1281 { 1282 if( TrophyIM.activeChatRoom.name[i].indexOf( jidChatRoom ) >= 0 ) 1283 { 1284 TrophyIM.activeChatRoom.name[i] = ""; 1285 } 1286 } 1287 } 1233 1288 1234 1235 1236 1289 setTimeout( function() 1290 { 1291 _winBuild("window_chat_room_" + jidChatRoom, "remove"); 1237 1292 1238 1293 }, 650 ); 1239 1294 1240 1295 }); 1241 1296 1242 1243 1244 1245 1246 1247 1248 1297 loadscript.configEvents( _textarea, 'onkeyup', function( e ) 1298 { 1299 if ( e.keyCode == 13 ) 1300 { 1301 _send_message( ); 1302 } 1303 }); 1249 1304 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1305 var winChatRoom = 1306 { 1307 id_window : "window_chat_room_" + arguments[0], 1308 barejid : jidChatRoom, 1309 width : 500, 1310 height : 450, 1311 top : TrophyIM.posWindow.top, 1312 left : TrophyIM.posWindow.left, 1313 draggable : true, 1314 visible : "display", 1315 resizable : true, 1316 zindex : loadscript.getZIndex(), 1317 title : titleWindow, 1318 closeAction : "hidden", 1319 content : _content 1320 } 1266 1321 1267 1322 _win = _winBuild(winChatRoom); 1268 1323 1269 return ( _messages = _win.content( ).firstChild ); 1324 _messages = _win.content( ).firstChild; 1325 1326 while ( _messages && _messages.nodeType !== 1 ) 1327 { 1328 _messages = _messages.nextSibling; 1329 } 1330 1331 return ( _messages ); 1332 1270 1333 1271 1334 }, 1272 1335 1273 1336 /** Function addContacts 1274 1337 * 1275 1338 * Parameters: … … 1280 1343 */ 1281 1344 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1345 addContact : function( jidTo, name, group ) 1346 { 1347 var _flag = true; 1348 1349 if( TrophyIM.removeResult.idResult.length > 0 ) 1350 { 1351 for( var i = 0 ; i < TrophyIM.removeResult.idResult.length; i++ ) 1352 { 1353 if( TrophyIM.removeResult.idResult[i] == jidTo ) 1354 { 1355 _flag = false; 1293 1356 1294 1357 TrophyIM.removeResult.idResult.splice(i,1); 1295 1358 1296 i--; 1297 } 1298 } 1299 } 1300 1301 if( _flag ) 1302 { 1303 // Add Contact 1304 var _id = TrophyIM.connection.getUniqueId('add'); 1305 var newContact = $iq({type: 'set', id: _id}); 1306 newContact = newContact.c('query').attrs({xmlns : 'jabber:iq:roster'}); 1307 newContact = newContact.c('item').attrs({jid: jidTo, name:name}); 1308 newContact = newContact.c('group').t(group).tree(); 1309 1310 TrophyIM.connection.send(newContact); 1311 } 1312 }, 1359 i--; 1360 } 1361 } 1362 } 1363 1364 if( _flag ) 1365 { 1366 // Add Contact 1367 var _id = TrophyIM.connection.getUniqueId('add'); 1368 var newContact = $iq({ 1369 type: 'set', 1370 id: _id 1371 }); 1372 newContact = newContact.c('query').attrs({ 1373 xmlns : 'jabber:iq:roster' 1374 }); 1375 newContact = newContact.c('item').attrs({ 1376 jid: jidTo, 1377 name:name 1378 }); 1379 newContact = newContact.c('group').t(group).tree(); 1380 1381 TrophyIM.connection.send(newContact); 1382 } 1383 }, 1313 1384 1314 1385 /** Function: add … … 1321 1392 addMessage : function( chatBox, jid, msg ) 1322 1393 { 1323 1324 1394 // Get Smiles 1395 msg.msg = loadscript.getSmiles( msg.msg ); 1325 1396 1326 1327 1328 1397 var messageDiv = document.createElement("div"); 1398 messageDiv.style.margin = "3px 0px 1em 3px"; 1399 messageDiv.innerHTML = msg.contact + " : " + msg.msg ; 1329 1400 1330 1331 1401 chatBox.appendChild(messageDiv); 1402 chatBox.scrollTop = chatBox.scrollHeight; 1332 1403 }, 1333 1404 … … 1339 1410 renameContact : function( jid ) 1340 1411 { 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1412 // Name 1413 var name = TrophyIM.rosterObj.roster[jid].contact.name; 1414 1415 if(( name = prompt(i18n.ASK_NEW_NAME_QUESTION + name + "!", name ))) 1416 if(( name = name.replace(/^\s+|\s+$|^\n|\n$/g,"")) == "" ) 1417 name = ""; 1418 1419 if( name == null || name == "") 1420 name = ""; 1421 1422 var jidTo = jid 1423 var name = ( name ) ? name : TrophyIM.rosterObj.roster[jid].contact.name; 1424 var group = TrophyIM.rosterObj.roster[jid].contact.groups[0]; 1354 1425 1355 1426 TrophyIM.addContact( jidTo, name, group ); 1356 1427 1357 1428 document.getElementById('itenContact_' + jid ).innerHTML = name; 1358 1429 }, 1359 1430 … … 1365 1436 renameGroup : function( jid ) 1366 1437 { 1367 1368 1438 var group = TrophyIM.rosterObj.roster[jid].contact.groups[0]; 1439 var presence = TrophyIM.rosterObj.roster[jid].presence; 1369 1440 1370 1441 // Group 1371 1442 if(( group = prompt( i18n.ASK_NEW_GROUP_QUESTION, group ))) 1372 1373 1443 if(( group = group.replace(/^\s+|\s+$|^\n|\n$/g,"")) == "" ) 1444 group = ""; 1374 1445 1375 1446 if( group == null || group == "") 1376 1377 1378 1379 1380 1381 1382 1383 1384 1447 group = ""; 1448 1449 var jidTo = TrophyIM.rosterObj.roster[jid].contact.jid; 1450 var name = TrophyIM.rosterObj.roster[jid].contact.name; 1451 var group = ( group ) ? group : TrophyIM.rosterObj.roster[jid].contact.groups[0]; 1452 1453 TrophyIM.rosterObj.removeContact( jid ); 1454 1455 TrophyIM.addContact( jidTo, name, group ); 1385 1456 1386 1387 1388 1457 document.getElementById("JabberIMRoster").innerHTML = ""; 1458 1459 TrophyIM.renderRoster(); 1389 1460 1390 1391 1392 1393 1394 1395 1461 setTimeout(function() 1462 { 1463 for( var i in presence ) 1464 { 1465 if ( presence[ i ].constructor == Function ) 1466 continue; 1396 1467 1397 1398 1399 1468 TrophyIM.rosterObj.setPresence( jid, presence[i].priority, presence[i].show, presence[i].status); 1469 } 1470 },500); 1400 1471 }, 1401 1472 … … 1407 1478 createChatRooms : function() 1408 1479 { 1409 1410 1480 var nickName = document.getElementById('nickName_chatRoom_jabberit').value; 1481 var nameChatRoom = document.getElementById('name_ChatRoom_jabberit').value; 1411 1482 1412 1483 var _from = Base64.decode( loadscript.getUserCurrent().jid ) + TROPHYIM_RESOURCE; 1413 1484 var _to = escape( nameChatRoom ) + "@" + TROPHYIM_CHATROOM + "/" + nickName ; 1414 var new_room = $pres( {from: _from, to: _to} ).c( "x", {xmlns: Strophe.NS.MUC} ); 1415 1416 TrophyIM.activeChatRoom.name[ TrophyIM.activeChatRoom.name.length ] = _to; 1417 1418 TrophyIM.connection.send( new_room.tree() ); 1485 var new_room = $pres( { 1486 from: _from, 1487 to: _to 1488 } ).c( "x", { 1489 xmlns: Strophe.NS.MUC 1490 } ); 1491 1492 TrophyIM.activeChatRoom.name[ TrophyIM.activeChatRoom.name.length ] = _to; 1493 1494 TrophyIM.connection.send( new_room.tree() ); 1419 1495 }, 1420 1496 … … 1426 1502 joinChatRoom : function( roomName ) 1427 1503 { 1428 var presence = $pres( {from: TrophyIM.connection.jid, to: roomName} ).c("x",{xmlns: Strophe.NS.MUC}); 1504 var presence = $pres( { 1505 from: TrophyIM.connection.jid, 1506 to: roomName 1507 } ).c("x",{ 1508 xmlns: Strophe.NS.MUC 1509 }); 1429 1510 1430 1511 TrophyIM.connection.send( presence ); 1431 1512 }, 1432 1513 … … 1438 1519 leaveChatRoom : function( roomName ) 1439 1520 { 1440 1521 var room_nick = roomName; 1441 1522 1442 1523 var presenceid = TrophyIM.connection.getUniqueId(); 1443 1524 1444 var presence = $pres( {type: "unavailable", id: presenceid, from: TrophyIM.connection.jid, to: room_nick} ).c("x",{xmlns: Strophe.NS.MUC}); 1525 var presence = $pres( { 1526 type: "unavailable", 1527 id: presenceid, 1528 from: TrophyIM.connection.jid, 1529 to: room_nick 1530 } ).c("x",{ 1531 xmlns: Strophe.NS.MUC 1532 }); 1445 1533 1446 1534 TrophyIM.connection.send( presence ); … … 1454 1542 getListRooms : function() 1455 1543 { 1456 1457 1458 1459 1460 1461 1544 if( TrophyIM.statusConn.connected ) 1545 { 1546 var _error_return = function(element) 1547 { 1548 alert("ERRO : Tente novamente !"); 1549 }; 1462 1550 1463 var iq = $iq({to: TROPHYIM_CHATROOM, type: "get"}).c("query",{xmlns: Strophe.NS.DISCO_ITEMS}); 1551 var iq = $iq({ 1552 to: TROPHYIM_CHATROOM, 1553 type: "get" 1554 }).c("query",{ 1555 xmlns: Strophe.NS.DISCO_ITEMS 1556 }); 1464 1557 1465 1466 1467 1468 1469 1470 1558 TrophyIM.connection.sendIQ( iq, loadscript.listRooms, _error_return, 500 ); 1559 } 1560 else 1561 { 1562 alert( "ERRO : Sem conexão com o servidor " + TROPHYIM_CHATROOM ); 1563 } 1471 1564 }, 1472 1565 … … 1479 1572 removeContact : function( jidTo ) 1480 1573 { 1481 1482 1483 1484 1485 1486 1574 var divItenContact = null; 1575 1576 if( ( divItenContact = document.getElementById('itenContact_' + jidTo ))) 1577 { 1578 // Remove Contact 1579 var _id = TrophyIM.connection.getUniqueId(); 1487 1580 1488 // Controller Result 1489 TrophyIM.removeResult.idResult[ TrophyIM.removeResult.idResult.length ] = jidTo; 1490 1491 var delContact = $iq({type: 'set', id: _id}) 1492 delContact = delContact.c('query').attrs({xmlns : 'jabber:iq:roster'}); 1493 delContact = delContact.c('item').attrs({jid: jidTo, subscription:'remove'}).tree(); 1494 1495 TrophyIM.connection.send( delContact ); 1581 // Controller Result 1582 TrophyIM.removeResult.idResult[ TrophyIM.removeResult.idResult.length ] = jidTo; 1583 1584 var delContact = $iq({ 1585 type: 'set', 1586 id: _id 1587 }) 1588 delContact = delContact.c('query').attrs({ 1589 xmlns : 'jabber:iq:roster' 1590 }); 1591 delContact = delContact.c('item').attrs({ 1592 jid: jidTo, 1593 subscription:'remove' 1594 }).tree(); 1595 1596 TrophyIM.connection.send( delContact ); 1496 1597 1497 1598 loadscript.removeElement( document.getElementById('itenContactNotification_' + jidTo ) ); 1498 1599 1499 1500 1600 var spanShow = document.getElementById('span_show_itenContact_' + jidTo ) 1601 spanShow.parentNode.removeChild(spanShow); 1501 1602 1502 1603 loadscript.removeGroup( divItenContact.parentNode ); 1503 1604 1504 1505 1605 divItenContact.parentNode.removeChild(divItenContact); 1606 } 1506 1607 }, 1507 1608 … … 1512 1613 */ 1513 1614 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1615 renderRoster : function() 1616 { 1617 var roster_div = document.getElementById('JabberIMRoster'); 1618 1619 if( roster_div ) 1620 { 1621 var users = new Array(); 1622 1623 var loading_gif = document.getElementById("JabberIMRosterLoadingGif"); 1624 1625 if( loading_gif.style.display == "block" ) 1626 loading_gif.style.display = "none"; 1526 1627 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1628 for( var user in TrophyIM.rosterObj.roster ) 1629 { 1630 if ( TrophyIM.rosterObj.roster[ user ].constructor == Function ) 1631 continue; 1632 1633 users[users.length] = TrophyIM.rosterObj.roster[user].contact.jid; 1634 } 1635 1636 users.sort(); 1637 1638 var groups = new Array(); 1639 var flagGeral = false; 1640 1641 for (var group in TrophyIM.rosterObj.groups) 1642 { 1643 if ( TrophyIM.rosterObj.groups[ group ].constructor == Function ) 1644 continue; 1544 1645 1545 1546 1646 if( group ) 1647 groups[groups.length] = group; 1547 1648 1548 1549 1649 if( group == "Geral" ) 1650 flagGeral = true; 1550 1651 } 1551 1652 1552 1553 1653 if( !flagGeral && users.length > 0 ) 1654 groups[groups.length] = "Geral"; 1554 1655 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1656 groups.sort(); 1657 1658 for ( var i = 0; i < groups.length; i++ ) 1659 { 1660 TrophyIM.renderGroups( groups[i] , roster_div ); 1661 } 1662 1663 TrophyIM.renderItensGroup( users, roster_div ); 1664 } 1665 1666 TrophyIM._timeOut.renderRoster = setTimeout("TrophyIM.renderRoster()", 1000 ); 1667 }, 1567 1668 1568 1669 /** Function: renderGroups … … 1571 1672 */ 1572 1673 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1674 renderGroups: function( nameGroup, element ) 1675 { 1676 var _addGroup = function() 1677 { 1678 var _nameGroup = nameGroup; 1679 var _element = element; 1680 1681 var paramsGroup = 1682 { 1683 'nameGroup' : _nameGroup, 1684 'path_jabberit' : path_jabberit 1685 } 1686 1687 _element.innerHTML += loadscript.parse("group","groups.xsl", paramsGroup); 1688 } 1689 1690 if( !element.hasChildNodes() ) 1691 { 1692 _addGroup(); 1693 } 1694 else 1695 { 1696 var _NodeChild = element.firstChild; 1697 var flagAdd = false; 1698 1699 while( _NodeChild ) 1700 { 1701 if( _NodeChild.childNodes[0].nodeName.toLowerCase() === "span" ) 1702 { 1703 if( _NodeChild.childNodes[0].childNodes[0].nodeValue === nameGroup ) 1704 { 1705 flagAdd = true; 1706 } 1707 } 1607 1708 1608 1609 1610 1611 1612 1613 1614 1615 1616 1709 _NodeChild = _NodeChild.nextSibling; 1710 } 1711 1712 if( !flagAdd ) 1713 { 1714 _addGroup(); 1715 } 1716 } 1717 }, 1617 1718 1618 1719 /** Function: renderItensGroup … … 1621 1722 */ 1622 1723 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1724 renderItensGroup : function( users, element ) 1725 { 1726 var addItem = function() 1727 { 1728 if( arguments.length > 0 ) 1729 { 1730 // Get Arguments 1731 var objContact = arguments[0]; 1732 var group = arguments[1]; 1733 var element = arguments[2]; 1734 var showOffline = loadscript.getShowContactsOffline(); 1634 1735 1635 1636 1637 1638 1639 1736 // Presence e Status 1737 var presence = "unavailable"; 1738 var status = ""; 1739 var statusColor = "black"; 1740 var statusDisplay = "none"; 1640 1741 1641 1742 var _resource = ""; 1642 1743 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1744 // Set Presence 1745 var _presence = function(objContact) 1746 { 1747 if (objContact.presence) 1748 { 1749 for (var resource in objContact.presence) 1750 { 1751 if ( objContact.presence[resource].constructor == Function ) 1752 continue; 1753 1754 if( objContact.presence[resource].show != 'invisible' ) 1755 presence = objContact.presence[resource].show; 1756 1757 if( objContact.contact.subscription != "both") 1758 presence = 'subscription'; 1658 1759 1659 1660 1661 1662 1663 1664 1665 1666 1760 if( objContact.presence[resource].status ) 1761 { 1762 status = " ( " + objContact.presence[resource].status + " ) "; 1763 statusDisplay = "block"; 1764 } 1765 } 1766 } 1767 }; 1667 1768 1668 1669 1670 1671 1672 1673 1674 1675 1769 // Set Subscription 1770 var _subscription = function( objContact ) 1771 { 1772 if( objContact.contact.subscription != "both" ) 1773 { 1774 switch( objContact.contact.subscription ) 1775 { 1776 case "none" : 1676 1777 1677 1678 1679 1680 1681 1778 status = " (( " + i18n.ASK_FOR_AUTH + " )) "; 1779 statusColor = "red"; 1780 break; 1781 1782 case "to" : 1682 1783 1683 1684 1685 1686 1687 1784 status = " (( " + i18n.CONTACT_ASK_FOR_AUTH + " )) "; 1785 statusColor = "orange"; 1786 break; 1787 1788 case "from" : 1688 1789 1689 1690 1691 1790 status = " (( " + i18n.AUTHORIZED + " )) "; 1791 statusColor = "green"; 1792 break; 1692 1793 1693 1794 case "subscribe" : 1694 1795 1695 1696 1697 1698 1699 1796 status = " (( " + i18n.AUTH_SENT + " )) "; 1797 statusColor = "red"; 1798 break; 1799 1800 case "not-in-roster" : 1700 1801 1701 1702 1703 1802 status = " (( " + i18n.ASK_FOR_AUTH_QUESTION + " )) "; 1803 statusColor = "orange"; 1804 break; 1704 1805 1705 1806 default : 1706 1807 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1808 break; 1809 } 1810 1811 statusDisplay = "block"; 1812 } 1813 }; 1814 1815 if( objContact.contact.subscription != "remove") 1816 { 1817 var itensJid = document.getElementById( "itenContact_" + objContact.contact.jid ); 1717 1818 1718 1719 1720 1721 1819 if( itensJid == null ) 1820 { 1821 // Name 1822 var nameContact = ""; 1722 1823 1723 1724 1725 1726 1727 1728 1729 1824 if ( objContact.contact.name ) 1825 nameContact = objContact.contact.name; 1826 else 1827 { 1828 nameContact = objContact.contact.jid; 1829 nameContact = nameContact.substring(0, nameContact.indexOf('@')); 1830 } 1730 1831 1731 1732 1832 // Get Presence 1833 _presence(objContact); 1733 1834 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1835 var paramsContact = 1836 { 1837 divDisplay : "block", 1838 id : 'itenContact_' + objContact.contact.jid , 1839 jid : objContact.contact.jid, 1840 nameContact : nameContact, 1841 path_jabberit : path_jabberit, 1842 presence : presence, 1843 spanDisplay : statusDisplay, 1844 status : status, 1845 statusColor : "black", 1846 subscription : objContact.contact.subscription, 1847 resource : _resource 1848 } 1748 1849 1749 1750 1850 // Get Authorization 1851 _subscription( objContact ); 1751 1852 1752 1753 1754 1853 if( group != "") 1854 { 1855 var _NodeChild = element.firstChild; 1755 1856 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1857 while( _NodeChild ) 1858 { 1859 if( _NodeChild.childNodes[0].nodeName.toLowerCase() === "span" ) 1860 { 1861 if( _NodeChild.childNodes[0].childNodes[0].nodeValue === group ) 1862 { 1863 _NodeChild.innerHTML += loadscript.parse("itens_group", "itensGroup.xsl", paramsContact); 1864 } 1865 } 1866 1867 _NodeChild = _NodeChild.nextSibling; 1868 } 1869 } 1870 } 1871 else 1872 { 1873 // Get Presence 1874 _presence(objContact); 1875 1876 var is_open = itensJid.parentNode.childNodes[0].style.backgroundImage; 1877 is_open = is_open.indexOf("arrow_down.gif"); 1878 1879 // Get Authorization 1880 _subscription( objContact ); 1780 1881 1781 1782 1882 // Set subscription 1883 itensJid.setAttribute('subscription', objContact.contact.subscription ); 1783 1884 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1885 with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid ) ) 1886 { 1887 if( presence == "unavailable" && !showOffline ) 1888 { 1889 style.display = "none"; 1890 } 1891 else 1892 { 1893 if( is_open > 0 ) 1894 { 1895 style.display = statusDisplay; 1896 style.color = statusColor; 1897 innerHTML = status; 1898 } 1899 } 1900 } 1800 1901 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1902 if( presence == "unavailable" && !showOffline ) 1903 { 1904 itensJid.style.display = "none"; 1905 } 1906 else 1907 { 1908 if( is_open > 0 ) 1909 { 1910 itensJid.style.display = "block"; 1911 } 1912 } 1812 1913 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1914 itensJid.style.background = "url('"+path_jabberit+"templates/default/images/" + presence + ".gif') no-repeat center left"; 1915 } 1916 1917 // Contact OffLine 1918 if( !objContact.presence && !showOffline ) 1919 { 1920 if( objContact.contact.subscription != "remove" ) 1921 { 1922 with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid )) 1923 { 1924 style.display = "none"; 1925 } 1926 1927 with ( document.getElementById('itenContact_' + objContact.contact.jid ) ) 1928 { 1929 style.display = "none"; 1930 } 1931 } 1932 } 1933 } 1934 } 1935 }; 1936 1937 var flag = false; 1938 1939 for( var i = 0 ; i < users.length; i++ ) 1940 { 1941 if( TrophyIM.rosterObj.roster[users[i]].contact.jid != Base64.decode( loadscript.getUserCurrent().jid) ) 1942 { 1943 var _subscription = TrophyIM.rosterObj.roster[users[i]].contact.subscription; 1843 1944 1844 1845 1846 1847 1945 if( _subscription === "to" ) 1946 { 1947 flag = true; 1948 } 1848 1949 1849 1850 1851 1852 1950 if( _subscription === "not-in-roster") 1951 { 1952 flag = true; 1953 } 1853 1954 1854 1855 1856 1955 if( TrophyIM.rosterObj.roster[users[i]].contact.groups ) 1956 { 1957 var groups = TrophyIM.rosterObj.roster[users[i]].contact.groups; 1857 1958 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1959 if( groups.length > 0 ) 1960 { 1961 for( var j = 0; j < groups.length; j++ ) 1962 { 1963 addItem( TrophyIM.rosterObj.roster[users[i]], groups[j], element ); 1964 } 1965 } 1966 else 1967 { 1968 addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element ); 1969 } 1970 } 1971 else 1972 { 1973 addItem( TrophyIM.rosterObj.roster[users[i]], "Geral", element ); 1974 } 1975 } 1976 } 1977 1978 if( flag ) 1979 { 1980 if ( TrophyIM.controll.notificationNewUsers == 0 ) 1981 { 1982 loadscript.enabledNotificationNewUsers(); 1983 TrophyIM.controll.notificationNewUsers++; 1984 } 1985 } 1986 else 1987 { 1988 loadscript.disabledNotificationNewUsers(); 1989 TrophyIM.controll.notificationNewUsers = 0; 1990 } 1991 }, 1891 1992 1892 1993 /** Function: rosterClick … … 1895 1996 */ 1896 1997 1897 1898 1998 rosterClick : function(fulljid) 1999 { 1899 2000 TrophyIM.makeChat(fulljid); 1900 2001 }, 1901 2002 1902 2003 /** Function SetAutorization 1903 2004 * 1904 2005 */ 1905 2006 1906 1907 1908 2007 setAutorization : function( jidTo, jidFrom, _typeSubscription ) 2008 { 2009 var _id = TrophyIM.connection.getUniqueId(); 1909 2010 1910 TrophyIM.connection.send($pres( ).attrs({from: jidFrom, to: jidTo, type: _typeSubscription, id: _id}).tree()); 1911 }, 1912 1913 /** Function: setPresence 1914 * 1915 */ 1916 1917 setPresence : function( _type ) 1918 { 1919 var presence_chatRoom = ""; 1920 1921 if( _type != 'status') 1922 { 1923 if( _type == "unavailable" && TrophyIM.statusConn.connected ) 1924 { 1925 var loading_gif = document.getElementById("JabberIMRosterLoadingGif"); 2011 TrophyIM.connection.send($pres( ).attrs({ 2012 from: jidFrom, 2013 to: jidTo, 2014 type: _typeSubscription, 2015 id: _id 2016 }).tree()); 2017 }, 2018 2019 /** Function: setPresence 2020 * 2021 */ 2022 2023 setPresence : function( _type ) 2024 { 2025 var presence_chatRoom = ""; 2026 2027 if( _type != 'status') 2028 { 2029 if( _type == "unavailable" && TrophyIM.statusConn.connected ) 2030 { 2031 var loading_gif = document.getElementById("JabberIMRosterLoadingGif"); 1926 2032 1927 1928 2033 if( TrophyIM._timeOut.renderRoster != null ) 2034 clearTimeout(TrophyIM._timeOut.renderRoster); 1929 2035 1930 if( TrophyIM.statusConn.connected ) 1931 TrophyIM.connection.send($pres({type : _type}).tree()); 2036 if( TrophyIM.statusConn.connected ) 2037 TrophyIM.connection.send($pres({ 2038 type : _type 2039 }).tree()); 1932 2040 1933 1934 1935 1936 1937 2041 for( var i = 0; i < TrophyIM.connection._requests.length; i++ ) 2042 { 2043 if( TrophyIM.connection._requests[i] ) 2044 TrophyIM.connection._removeRequest(TrophyIM.connection._requests[i]); 2045 } 1938 2046 1939 2047 TrophyIM.logout(); 1940 2048 1941 2049 loadscript.clrAllContacts(); 1942 2050 1943 1944 2051 delete TrophyIM.rosterObj.roster; 2052 delete TrophyIM.rosterObj.groups; 1945 2053 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 2054 setTimeout(function() 2055 { 2056 if( loading_gif.style.display == "block" ) 2057 loading_gif.style.display = "none"; 2058 }, 1000); 2059 } 2060 else 2061 { 2062 if( !TrophyIM.autoConnection.connect ) 2063 { 2064 TrophyIM.autoConnection.connect = true; 2065 TrophyIM.load(); 2066 } 2067 else 2068 { 2069 if( TrophyIM.statusConn.connected ) 2070 { 2071 if( loadscript.getStatusMessage() != "" ) 2072 { 2073 var _presence = $pres( ); 2074 _presence.node.appendChild( Strophe.xmlElement( 'show' ) ).appendChild( Strophe.xmlTextNode( _type ) ); 2075 _presence.node.appendChild( Strophe.xmlElement( 'status' ) ).appendChild( Strophe.xmlTextNode( loadscript.getStatusMessage() )); 1968 2076 1969 2077 TrophyIM.connection.send( _presence.tree() ); 1970 2078 1971 1972 1973 1974 1975 2079 presence_chatRoom = _type; 2080 } 2081 else 2082 { 2083 TrophyIM.connection.send($pres( ).c('show').t(_type).tree()); 1976 2084 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 2085 presence_chatRoom = _type; 2086 } 2087 } 2088 } 2089 } 2090 } 2091 else 2092 { 2093 var _show = "available"; 2094 var _status = ""; 2095 2096 if( arguments.length < 2 ) 2097 { 2098 if( loadscript.getStatusMessage() != "" ) 2099 _status = prompt(i18n.TYPE_YOUR_MSG, loadscript.getStatusMessage()); 2100 else 2101 _status = prompt(i18n.TYPE_YOUR_MSG); 1994 2102 1995 2103 var _divStatus = document.getElementById("JabberIMStatusMessage"); 1996 2104 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2105 if( ( _status = _status.replace(/^\s+|\s+$|^\n|\n$/g,"") ) != "") 2106 _divStatus.firstChild.innerHTML = "( " + _status + " )"; 2107 } 2108 else 2109 { 2110 _status = arguments[1]; 2111 } 2112 2113 for( var resource in TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence ) 2114 { 2115 if ( TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence[ resource ].constructor == Function ) 2116 continue; 2009 2117 2010 2011 2012 2013 2014 2015 2016 2017 2018 2118 if ( TROPHYIM_RESOURCE === ("/" + resource) ) 2119 _show = TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence[resource].show; 2120 } 2121 2122 if ( TrophyIM.statusConn.connected ) 2123 { 2124 var _presence = $pres( ); 2125 _presence.node.appendChild( Strophe.xmlElement( 'show' ) ).appendChild( Strophe.xmlTextNode( _show ) ); 2126 _presence.node.appendChild( Strophe.xmlElement( 'status' ) ).appendChild( Strophe.xmlTextNode( _status ) ); 2019 2127 2020 2128 TrophyIM.connection.send( _presence.tree() ); 2021 2129 2022 presence_chatRoom = _show; 2023 } 2024 } 2025 2026 // Send Presence Chat Room 2027 if( TrophyIM.activeChatRoom.name.length > 0 ) 2028 { 2029 for( i = 0; i < TrophyIM.activeChatRoom.name.length; i++ ) 2030 { 2031 if( TrophyIM.activeChatRoom.name[i] != "" ) 2032 TrophyIM.connection.send($pres( {to : TrophyIM.activeChatRoom.name[i]} ).c('show').t( presence_chatRoom ) ); 2033 } 2034 } 2035 2036 }, 2037 2038 /** Function: sendMessage 2130 presence_chatRoom = _show; 2131 } 2132 } 2133 2134 // Send Presence Chat Room 2135 if( TrophyIM.activeChatRoom.name.length > 0 ) 2136 { 2137 for( i = 0; i < TrophyIM.activeChatRoom.name.length; i++ ) 2138 { 2139 if( TrophyIM.activeChatRoom.name[i] != "" ) 2140 TrophyIM.connection.send($pres( { 2141 to : TrophyIM.activeChatRoom.name[i] 2142 } ).c('show').t( presence_chatRoom ) ); 2143 } 2144 } 2145 2146 }, 2147 2148 /** Function: sendMessage 2039 2149 * 2040 2150 * Send message from chat input to user … … 2043 2153 sendMessage : function() 2044 2154 { 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2155 if (arguments.length > 0) 2156 { 2157 var jidTo = arguments[0]; 2158 var message_input = arguments[1]; 2159 2160 2161 message_input = message_input.replace(/^\s+|\s+$|^\n|\n$/g, ""); 2162 2163 if (message_input != "") { 2164 2165 // Send Message 2166 var newMessage = $msg({ 2167 to: jidTo, 2168 from: TrophyIM.connection.jid, 2169 type: 'chat' 2170 }); 2171 newMessage = newMessage.c('body').t(message_input); 2172 newMessage.up(); 2173 newMessage = newMessage.c('active').attrs({ 2174 xmlns: 'http://jabber.org/protocol/chatstates' 2175 }); 2176 // Send Message 2177 TrophyIM.connection.send(newMessage.tree()); 2068 2178 2069 2070 2071 2072 2073 2074 }, 2075 2076 2179 return true; 2180 } 2181 } 2182 2183 return false; 2184 }, 2185 2186 /** Function: sendMessage 2077 2187 * 2078 2188 * Send message to ChatRoom … … 2081 2191 sendMessageChatRoom : function( ) 2082 2192 { 2083 if( arguments.length > 0 ) 2084 { 2085 var room_nick = arguments[0]; 2086 var message = arguments[1]; 2087 var msgid = TrophyIM.connection.getUniqueId(); 2088 var msg = $msg({to: room_nick, type: "groupchat", id: msgid}).c("body",{xmlns: Strophe.NS.CLIENT}).t(message); 2193 if( arguments.length > 0 ) 2194 { 2195 var room_nick = arguments[0]; 2196 var message = arguments[1]; 2197 var msgid = TrophyIM.connection.getUniqueId(); 2198 var msg = $msg({ 2199 to: room_nick, 2200 type: "groupchat", 2201 id: msgid 2202 }).c("body",{ 2203 xmlns: Strophe.NS.CLIENT 2204 }).t(message); 2089 2205 2090 2206 msg.up();//.c("x", {xmlns: "jabber:x:event"}).c("composing"); 2091 2207 2092 2208 TrophyIM.connection.send(msg); 2093 2209 2094 2095 2096 }, 2097 2098 2210 return true; 2211 } 2212 }, 2213 2214 /** Function: sendContentMessage 2099 2215 * 2100 2216 * Send a content message from chat input to user 2101 2217 */ 2102 sendContentMessage : function() 2103 { 2104 if( arguments.length > 0 ) 2105 { 2106 var jidTo = arguments[0]; 2107 var state = arguments[1]; 2108 2109 var newMessage = $msg({to: jidTo, from: TrophyIM.connection.jid, type: 'chat'}); 2110 newMessage = newMessage.c(state).attrs({xmlns : 'http://jabber.org/protocol/chatstates'}); 2111 // Send content message 2112 TrophyIM.connection.send(newMessage.tree()); 2113 } 2218 sendContentMessage : function() 2219 { 2220 if( arguments.length > 0 ) 2221 { 2222 var jidTo = arguments[0]; 2223 var state = arguments[1]; 2224 2225 var newMessage = $msg({ 2226 to: jidTo, 2227 from: TrophyIM.connection.jid, 2228 type: 'chat' 2229 }); 2230 newMessage = newMessage.c(state).attrs({ 2231 xmlns : 'http://jabber.org/protocol/chatstates' 2232 }); 2233 // Send content message 2234 TrophyIM.connection.send(newMessage.tree()); 2235 } 2114 2236 } 2115 2237 }; … … 2131 2253 */ 2132 2254 if (TrophyIM.JSONStore.store_working) 2133 2255 { 2134 2256 var data = TrophyIM.JSONStore.getData(['roster', 'groups']); 2135 2257 this.roster = (data['roster'] != null) ? data['roster'] : {}; 2136 2258 this.groups = (data['groups'] != null) ? data['groups'] : {}; 2137 2259 } 2138 2139 2260 else 2261 { 2140 2262 this.roster = {}; 2141 2263 this.groups = {}; … … 2143 2265 this.changes = new Array(); 2144 2266 2145 2146 2267 if (TrophyIM.constants.stale_roster) 2268 { 2147 2269 for (var jid in this.roster) 2148 2149 2270 { 2271 this.changes[this.changes.length] = jid; 2150 2272 } 2151 2273 } 2152 2274 2153 2275 /** Function: addChange 2154 2276 * 2155 2277 * Adds given jid to this.changes, keeping this.changes sorted and … … 2160 2282 */ 2161 2283 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2284 this.addChange = function(jid) 2285 { 2286 for (var c = 0; c < this.changes.length; c++) 2287 { 2288 if (this.changes[c] == jid) 2289 { 2290 return; 2291 } 2292 } 2293 2294 this.changes[this.changes.length] = jid; 2295 2296 this.changes.sort(); 2297 } 2176 2298 2177 2299 /** Function: addContact … … 2186 2308 */ 2187 2309 2188 this.addContact = function(jid, subscription, name, groups ) 2189 { 2190 if( subscription === "remove" ) 2191 { 2192 this.removeContact(jid); 2193 } 2194 else 2195 { 2196 var contact = {jid:jid, subscription:subscription, name:name, groups:groups} 2197 var jid_lower = jid.toLowerCase(); 2198 2199 if ( this.roster[jid_lower] ) 2200 { 2201 this.roster[jid_lower]['contact'] = contact; 2202 } 2203 else 2204 { 2205 this.roster[jid_lower] = {contact:contact}; 2206 } 2207 2208 groups = groups ? groups : ['']; 2310 this.addContact = function(jid, subscription, name, groups ) 2311 { 2312 if( subscription === "remove" ) 2313 { 2314 this.removeContact(jid); 2315 } 2316 else 2317 { 2318 var contact = { 2319 jid:jid, 2320 subscription:subscription, 2321 name:name, 2322 groups:groups 2323 } 2324 var jid_lower = jid.toLowerCase(); 2325 2326 if ( this.roster[jid_lower] ) 2327 { 2328 this.roster[jid_lower]['contact'] = contact; 2329 } 2330 else 2331 { 2332 this.roster[jid_lower] = { 2333 contact:contact 2334 }; 2335 } 2336 2337 groups = groups ? groups : ['']; 2209 2338 2210 2211 2212 2213 2214 2215 2339 for ( var g = 0; g < groups.length; g++ ) 2340 { 2341 if ( !this.groups[groups[g]] ) 2342 { 2343 this.groups[groups[g]] = {}; 2344 } 2216 2345 2217 2218 2219 2346 this.groups[groups[g]][jid_lower] = jid_lower; 2347 } 2348 } 2220 2349 } 2221 2350 … … 2228 2357 2229 2358 this.getContact = function(jid) 2230 2359 { 2231 2360 if (this.roster[jid.toLowerCase()]) 2232 2361 { 2233 2362 return this.roster[jid.toLowerCase()]['contact']; 2234 2363 } 2235 2364 } 2236 2365 2237 /** Function: getPresence2366 /** Function: getPresence 2238 2367 * 2239 2368 * Returns best presence for given jid as Array(resource, priority, show, … … 2243 2372 */ 2244 2373 2245 2246 2247 2248 2374 this.getPresence = function(fulljid) 2375 { 2376 var jid = Strophe.getBareJidFromJid(fulljid); 2377 var current = null; 2249 2378 2250 2251 2252 2253 2254 2255 2379 if (this.roster[jid.toLowerCase()] && this.roster[jid.toLowerCase()]['presence']) 2380 { 2381 for (var resource in this.roster[jid.toLowerCase()]['presence']) 2382 { 2383 if ( this.roster[jid.toLowerCase()]['presence'][ resource ].constructor == Function ) 2384 continue; 2256 2385 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2386 var presence = this.roster[jid.toLowerCase()]['presence'][resource]; 2387 if (current == null) 2388 { 2389 current = presence 2390 } 2391 else 2392 { 2393 if(presence['priority'] > current['priority'] && ((presence['show'] == "chat" 2394 || presence['show'] == "available") || (current['show'] != "chat" || 2395 current['show'] != "available"))) 2396 { 2397 current = presence 2398 } 2399 } 2400 } 2401 } 2402 return current; 2403 } 2404 2405 /** Function: groupHasChanges 2277 2406 * 2278 2407 * Returns true if current group has members in this.changes … … 2282 2411 */ 2283 2412 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2413 this.groupHasChanges = function(group) 2414 { 2415 for (var c = 0; c < this.changes.length; c++) 2416 { 2417 if (this.groups[group][this.changes[c]]) 2418 { 2419 return true; 2420 } 2421 } 2422 return false; 2423 } 2424 2425 /** Function removeContact 2297 2426 * 2298 2427 * Parameters … … 2300 2429 */ 2301 2430 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2431 this.removeContact = function(jid) 2432 { 2433 if( this.roster[ jid ] ) 2434 { 2435 var groups = this.roster[ jid ].contact.groups; 2436 2437 if( groups ) 2438 { 2439 for ( var i = 0; i < groups.length; i++ ) 2440 { 2441 delete this.groups[ groups[ i ] ][ jid ]; 2442 } 2443 2444 for ( var i = 0; i < groups.length; i++ ) 2445 { 2446 var contacts = 0; 2447 for ( var contact in this.groups[ groups[ i ] ] ) 2448 { 2449 if ( this.groups[ groups[ i ] ][ contact ].constructor == Function ) 2450 continue; 2322 2451 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2452 contacts++; 2453 } 2454 2455 if ( ! contacts ) 2456 delete this.groups[ groups[ i ] ]; 2457 } 2458 } 2459 2460 // Delete Object roster 2461 if( this.roster[jid] ) 2462 delete this.roster[jid]; 2463 } 2464 } 2336 2465 2337 2466 /** Function: setPresence … … 2346 2475 */ 2347 2476 2348 2349 2350 2477 this.setPresence = function(fulljid, priority, show, status) 2478 { 2479 var barejid = Strophe.getBareJidFromJid(fulljid); 2351 2480 var resource = Strophe.getResourceFromJid(fulljid); 2352 2481 var jid_lower = barejid.toLowerCase(); 2353 2482 2354 2483 if( show !== 'unavailable' || show !== 'error' ) 2355 2356 2357 2484 { 2485 if (!this.roster[jid_lower]) 2486 { 2358 2487 this.addContact( barejid, 'not-in-roster' ); 2359 2488 } 2360 2489 2361 2490 var presence = 2362 2491 { 2363 2492 resource : resource, 2364 2493 priority : priority, … … 2367 2496 } 2368 2497 2369 2370 2498 if (!this.roster[jid_lower]['presence']) 2499 { 2371 2500 this.roster[jid_lower]['presence'] = {}; 2372 2501 } 2373 2502 2374 2503 this.roster[jid_lower]['presence'][resource] = presence; 2375 2504 } 2376 2505 } 2377 2506 2378 2507 /** Fuction: save 2379 2508 * 2380 2509 * Saves roster data to JSON store 2381 2510 */ 2382 2511 2383 this.save = function() 2384 { 2385 if (TrophyIM.JSONStore.store_working) 2386 { 2387 TrophyIM.JSONStore.setData({roster:this.roster, 2388 groups:this.groups, active_chat:TrophyIM.activeChats['current'], 2389 chat_history:TrophyIM.chatHistory}); 2390 } 2391 } 2512 this.save = function() 2513 { 2514 if (TrophyIM.JSONStore.store_working) 2515 { 2516 TrophyIM.JSONStore.setData({ 2517 roster:this.roster, 2518 groups:this.groups, 2519 active_chat:TrophyIM.activeChats['current'], 2520 chat_history:TrophyIM.chatHistory 2521 }); 2522 } 2523 } 2392 2524 2393 2525 } … … 2408 2540 * (function) handler = what to set onreadystatechange to 2409 2541 */ 2410 2542 this._newXHR = function (handler) { 2411 2543 var xhr = null; 2412 2544 if (window.XMLHttpRequest) { 2413 2545 xhr = new XMLHttpRequest(); 2414 2546 if (xhr.overrideMimeType) { 2415 xhr.overrideMimeType("text/xml");2547 xhr.overrideMimeType("text/xml"); 2416 2548 } 2417 2549 } else if (window.ActiveXObject) { … … 2441 2573 } 2442 2574 xhr.setRequestHeader('Content-type', 2443 'application/x-www-form-urlencoded');2575 'application/x-www-form-urlencoded'); 2444 2576 xhr.setRequestHeader('Content-length', getdata.length); 2445 2577 xhr.send(getdata); … … 2450 2582 } catch(e) { 2451 2583 Strophe.error("Could not parse JSONStore response" + 2452 xhr.responseText);2584 xhr.responseText); 2453 2585 return false; 2454 2586 } … … 2467 2599 if (typeof(obj) == "object") { 2468 2600 for (var i in obj) { 2469 2470 2601 if ( obj[i].constructor == Function ) 2602 continue; 2471 2603 2472 2604 if (i == '_empty_') { … … 2501 2633 } 2502 2634 xhr.setRequestHeader('Content-type', 2503 'application/x-www-form-urlencoded');2635 'application/x-www-form-urlencoded'); 2504 2636 xhr.setRequestHeader('Content-length', deldata.length); 2505 2637 xhr.send(deldata); … … 2530 2662 this.setData = function(vars) 2531 2663 { 2532 2664 if ( typeof(TROPHYIM_JSON_STORE) != undefined ) 2533 2665 { 2534 2666 var senddata = "set=" + JSON.stringify(vars); … … 2544 2676 } 2545 2677 xhr.setRequestHeader('Content-type', 2546 'application/x-www-form-urlencoded');2678 'application/x-www-form-urlencoded'); 2547 2679 xhr.setRequestHeader('Content-length', senddata.length); 2548 2680 xhr.send(senddata); 2549 2681 if (xhr.readyState == 4 && xhr.status == 200 && xhr.responseText == 2550 "OK") {2682 "OK") { 2551 2683 return true; 2552 2684 } else { … … 2559 2691 var testData = true; 2560 2692 2561 if (this.setData({testData:testData})) { 2693 if (this.setData({ 2694 testData:testData 2695 })) { 2562 2696 var testResult = this.getData(['testData']); 2563 2697 if (testResult && testResult['testData'] == true) { … … 2601 2735 for(var i = 0; i < node.attributes.length; i++) { 2602 2736 newNode.setAttribute(node.attributes[i].nodeName, 2603 node.getAttribute(node.attributes[i].nodeName));2737 node.getAttribute(node.attributes[i].nodeName)); 2604 2738 } 2605 2739 } 2606 2740 if (allChildren && node.childNodes && 2607 node.childNodes.length > 0) {2741 node.childNodes.length > 0) { 2608 2742 for (var i = 0; i < node.childNodes.length; i++) { 2609 2743 newNode.appendChild(document.importNode( 2610 node.childNodes[i], allChildren));2744 node.childNodes[i], allChildren)); 2611 2745 } 2612 2746 } … … 2631 2765 window.onunload = function() 2632 2766 { 2633 2634 2767 if( oldonunload ) 2768 { 2635 2769 oldonunload(); 2636 2770 } 2637 2771 2638 2772 TrophyIM.setPresence('unavailable'); 2639 2773 } -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/jmessenger/js/trophyim.mini.js
r4420 r4644 171 171 {return i18n.PAUSED;}}}} 172 172 return'';},makeChat:function(fulljid) 173 {var barejid=Strophe.getBareJidFromJid(fulljid);var titleWindow="";var paramsChatBox={'enabledPopUp':((loadscript.get IsIE())?"none":"block"),'idChatBox':barejid+"__chatBox",'jidTo':barejid,'path_jabberit':path_jabberit};titleWindow=barejid.toLowerCase();titleWindow=titleWindow.substring(0,titleWindow.indexOf('@'));if(TrophyIM.rosterObj.roster[barejid])173 {var barejid=Strophe.getBareJidFromJid(fulljid);var titleWindow="";var paramsChatBox={'enabledPopUp':((loadscript.getBrowserCompatible())?"block":"none"),'idChatBox':barejid+"__chatBox",'jidTo':barejid,'path_jabberit':path_jabberit};titleWindow=barejid.toLowerCase();titleWindow=titleWindow.substring(0,titleWindow.indexOf('@'));if(TrophyIM.rosterObj.roster[barejid]) 174 174 {if(TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name']) 175 175 {titleWindow=TrophyIM.rosterObj.roster[barejid.toLowerCase()]['contact']['name'];}} … … 186 186 {if(e.keyCode==13){_send_message();composingTimer_=0;clearInterval(timeCounter);}else{if(_chatStateOnOff.value=='on') 187 187 setComposing();}});var winChatBox={id_window:"window_chat_area_"+barejid,barejid:barejid,width:387,height:375,top:TrophyIM.posWindow.top,left:TrophyIM.posWindow.left,draggable:true,visible:"display",resizable:true,zindex:loadscript.getZIndex(),title:titleWindow,closeAction:"hidden",content:_content} 188 _win=_winBuild(winChatBox);loadscript.notification(barejid);loadscript.getPhotoUser(barejid);_textarea.focus();return(_messages=_win.content().firstChild);},makeChatRoom:function() 188 _win=_winBuild(winChatBox);loadscript.notification(barejid);loadscript.getPhotoUser(barejid);_textarea.focus();_messages=_win.content().firstChild;while(_messages&&_messages.nodeType!==1) 189 {_messages=_messages.nextSibling;} 190 return(_messages);},makeChatRoom:function() 189 191 {var jidChatRoom=arguments[0];var titleWindow="ChatRoom - "+unescape(arguments[1]);var paramsChatRoom={'idChatRoom':jidChatRoom+"__roomChat",'jidTo':jidChatRoom,'lang_Send':i18n.SEND,'lang_Leave_ChatRoom':i18n.LEAVE_CHATROOM,'path_jabberit':path_jabberit};TrophyIM.posWindow.top=TrophyIM.posWindow.top+10;if(TrophyIM.posWindow.top>200) 190 192 TrophyIM.posWindow.top=100;TrophyIM.posWindow.left=TrophyIM.posWindow.left+5;if(TrophyIM.posWindow.left>455) … … 200 202 {if(e.keyCode==13) 201 203 {_send_message();}});var winChatRoom={id_window:"window_chat_room_"+arguments[0],barejid:jidChatRoom,width:500,height:450,top:TrophyIM.posWindow.top,left:TrophyIM.posWindow.left,draggable:true,visible:"display",resizable:true,zindex:loadscript.getZIndex(),title:titleWindow,closeAction:"hidden",content:_content} 202 _win=_winBuild(winChatRoom);return(_messages=_win.content().firstChild);},addContact:function(jidTo,name,group) 204 _win=_winBuild(winChatRoom);_messages=_win.content().firstChild;while(_messages&&_messages.nodeType!==1) 205 {_messages=_messages.nextSibling;} 206 return(_messages);},addContact:function(jidTo,name,group) 203 207 {var _flag=true;if(TrophyIM.removeResult.idResult.length>0) 204 208 {for(var i=0;i<TrophyIM.removeResult.idResult.length;i++) -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/js
-
Property
svn:ignore
set to
.xtools.js.swp
-
Property
svn:ignore
set to
-
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/setup/setup.inc.php
r4173 r4644 8 8 $setup_info['jabberit_messenger']['name'] = 'jabberit_messenger'; 9 9 $setup_info['jabberit_messenger']['title'] = 'Expresso Messenger'; 10 $setup_info['jabberit_messenger']['version'] = '2.2. 1';10 $setup_info['jabberit_messenger']['version'] = '2.2.2'; 11 11 $setup_info['jabberit_messenger']['app_order'] = 9; 12 12 $setup_info['jabberit_messenger']['enable'] = 1; -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/templates/default/confGroupsLocked.tpl
r3102 r4644 1 1 <!-- BEGIN confGroups --> 2 2 <script type="text/javascript" src="jabberit_messenger/js/connector.js"></script> 3 <script type="text/javascript" src=" jabberit_messenger/js/xtools.js"></script>3 <script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script> 4 4 <script type="text/javascript" src="jabberit_messenger/controller.php?act=j.setup"></script> 5 5 <form> -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/templates/default/confServersJabber.tpl
r3102 r4644 1 1 <!-- BEGIN confServersJabber --> 2 2 <script type="text/javascript" src="jabberit_messenger/js/connector.js"></script> 3 <script type="text/javascript" src=" jabberit_messenger/js/xtools.js"></script>3 <script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script> 4 4 <script type="text/javascript" src="jabberit_messenger/controller.php?act=j.setup"></script> 5 5 <form> -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/templates/default/config.tpl
r3102 r4644 1 1 <!-- BEGIN header --> 2 2 <script type="text/javascript" src="jabberit_messenger/js/connector.js"></script> 3 <script type="text/javascript" src=" jabberit_messenger/js/xtools.js"></script>3 <script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script> 4 4 <script type="text/javascript" src="jabberit_messenger/controller.php?act=j.setup"></script> 5 5 <form method="POST" action="{action_url}"> -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/templates/default/enabled_ou_groups.tpl
r3406 r4644 1 1 <!-- BEGIN enabled_ous --> 2 2 <script type="text/javascript" src="jabberit_messenger/js/connector.js"></script> 3 <script type="text/javascript" src=" jabberit_messenger/js/xtools.js"></script>3 <script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script> 4 4 <form> 5 5 <table align="center" width="90%" cellspacing="2" style="border:1px solid #000;margin-top:20px;"> -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/templates/default/groupsLdap.tpl
r3102 r4644 19 19 <!-- BEGIN edit_servers --> 20 20 <script type="text/javascript" src="jabberit_messenger/js/connector.js"></script> 21 <script type="text/javascript" src=" jabberit_messenger/js/xtools.js"></script>21 <script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script> 22 22 <script type="text/javascript" src="jabberit_messenger/controller.php?act=j.groups_ldap"></script> 23 23 -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/templates/default/groupslocked.tpl
r3102 r4644 1 1 <!-- BEGIN groups_locked --> 2 2 <script type="text/javascript" src="jabberit_messenger/js/connector.js"></script> 3 <script type="text/javascript" src=" jabberit_messenger/js/xtools.js"></script>3 <script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script> 4 4 <script type="text/javascript" src="jabberit_messenger/controller.php?act=j.groups_ldap"></script> 5 5 <form method="POST" action="{action_url}"> -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/templates/default/indexIM.tpl
r3228 r4644 33 33 34 34 <fieldset style="margin-bottom:10px; width:250px;"> 35 <legend><img src=" {url}jmessenger/templates/default/images/compatible_epiphany.png" align="middle"/><span style="margin:5px;">Epiphany</span></legend>35 <legend><img src="../phpgwapi/images/compatible_epiphany.png" align="middle"/><span style="margin:5px;">Epiphany</span></legend> 36 36 <span> Versão : 2.22 ou superior </span><br/> 37 37 <span> Avaliação : <span style="color:red;font-weight:bold;">Ideal para o uso</span></span> … … 39 39 <br/> 40 40 <fieldset style="margin-bottom:10px; width:250px;"> 41 <legend><img src=" {url}jmessenger/templates/default/images/compatible_iceweasel.png" align="middle"/><span style="margin:5px;">Iceweasel</span></legend>41 <legend><img src="../phpgwapi/images/compatible_iceweasel.png" align="middle"/><span style="margin:5px;">Iceweasel</span></legend> 42 42 <span> Versão : 3.06 ou superior </span><br/> 43 43 <span> Avaliação : <span style="color:red;font-weight:bold;">Ideal para o uso</span></span> … … 45 45 <br/> 46 46 <fieldset style="margin-bottom:10px; width:250px;"> 47 <legend><img src=" {url}jmessenger/templates/default/images/compatible_ie.gif" align="middle" /><span style="margin:5px;">Internet Explorer ( IE )</span></legend>47 <legend><img src="../phpgwapi/images/compatible_ie.gif" align="middle" /><span style="margin:5px;">Internet Explorer ( IE )</span></legend> 48 48 <span> Versão : 8.0 </span><br/> 49 49 <span> Avaliação : Recomendado</span> … … 51 51 <br/> 52 52 <fieldset style="margin-bottom:10px; width:250px;"> 53 <legend><img src=" {url}jmessenger/templates/default/images/compatible_firefox.gif" align="middle"/><span style="margin:5px;">Mozilla Firefox</span></legend>53 <legend><img src="../phpgwapi/images/compatible_firefox.gif" align="middle"/><span style="margin:5px;">Mozilla Firefox</span></legend> 54 54 <span> Versão : 3.0 ou superior </span><br/> 55 55 <span> Avaliação : <span style="color:red;font-weight:bold;">Ideal para o uso</span></span> -
sandbox/expressoMail1_2/MailArchiver/2.2/jabberit_messenger/templates/default/jmessenger.tpl
r3102 r4644 1 1 <!-- BEGIN edit_groups_jmessenger --> 2 2 <script type="text/javascript" src="jabberit_messenger/js/connector.js"></script> 3 <script type="text/javascript" src=" jabberit_messenger/js/xtools.js"></script>3 <script type="text/javascript" src="phpgwapi/js/x_tools/xtools.js"></script> 4 4 <script type="text/javascript" src="jabberit_messenger/controller.php?act=j.groups_ldap"></script> 5 5 -
sandbox/expressoMail1_2/MailArchiver/2.2/mobile/inc/class.ui_mobilecc.inc.php
r3964 r4644 22 22 'contact_add_edit' => true, 23 23 'contact_add' => true, 24 'contact_edit' => true 24 'contact_edit' => true, 25 'getPhoto' => true 25 26 ); 26 27 var $template; … … 504 505 default: 505 506 506 if(strpos($params['catalog'],'bo_global_ldap_catalog')==false){ 507 if( strpos($params['catalog'],'bo_global_ldap_catalog') === false ) 508 { 509 header('Location: ../mobile/index.php?menuaction=mobile.ui_mobilecc.init_cc'); 510 } 511 else 512 { 507 513 508 514 $this->bo->set_catalog($params['catalog']); … … 510 516 $fields = $this->bo->bo->get_fields(true); 511 517 $result = $this->bo->bo->get_single_entry($params['id'], $fields); 512 513 $this->template->set_var('photo', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_photo&id='.$params["id"]); 518 519 // SessionStart 520 session_start(); 521 $_SESSION['phpgw_info']['mobile']['photoCatalog'][$params['id']] = $result['photo']; 522 session_write_close(); 523 524 525 $this->template->set_var('photo', '../index.php?menuaction=mobile.ui_mobilecc.getPhoto&id=' . $params["id"]); 514 526 515 527 $this->template->set_var('cc_name',$result['names_ordered'][0]); … … 565 577 $this->template->parse("row_body","people_ldap"); 566 578 567 }else{568 header('Location: ../mobile/index.php?menuaction=mobile.ui_mobilecc.init_cc');569 579 } 570 580 … … 572 582 } 573 583 574 if ( !empty($email_to)){ 584 if ( !empty($email_to)) 585 { 575 586 $this->template->set_var('email_to', $email_to); 576 587 $this->template->parse("buttom_use","buttom_use_contact"); … … 587 598 $GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out','body')); 588 599 } 600 601 function getPhoto() 602 { 603 $id = $_GET['id']; 604 605 session_start(); 606 607 if( isset( $_SESSION['phpgw_info']['mobile']['photoCatalog'][$id] ) ) 608 { 609 $photo = imagecreatefromstring($_SESSION['phpgw_info']['mobile']['photoCatalog'][$id]); 610 611 header("Content-Type: image/jpeg"); 612 $width = imagesx($photo); 613 $height = imagesy($photo); 614 $twidth = 70; 615 $theight = 90; 616 $small_photo = imagecreatetruecolor ($twidth, $theight); 617 imagecopyresampled($small_photo, $photo, 0, 0, 0, 0,$twidth, $theight, $width, $height); 618 imagejpeg($small_photo,'',100); 619 620 unset( $_SESSION['phpgw_info']['mobile']['photoCatalog'][$id] ); 621 } 622 else 623 { 624 header('Content-type: image/png'); 625 echo file_get_contents(PHPGW_INCLUDE_ROOT.'/contactcenter/templates/default/images/photo_celepar.png'); 626 } 627 628 session_write_close(); 629 630 return; 631 } 589 632 590 633 /** -
sandbox/expressoMail1_2/MailArchiver/2.2/mobile/inc/class.ui_mobilemail.inc.php
r4320 r4644 487 487 function print_mails_list($messages,$print_checkbox=false) 488 488 { 489 $functions = $this->common; 489 $flagImportant = intval($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_important_flag']); 490 491 $functions = $this->common; 490 492 $p = $this->template; 491 493 $p->set_file( array( 'mobilemail_t' => 'mails_list.tpl' ) ); … … 522 524 $flag="email-lido "; 523 525 524 if( $message["Flagged"]==="F")526 if( $message["Flagged"]==="F" && $flagImportant == 1 ) 525 527 $flag.="email-importante"; 526 528 -
sandbox/expressoMail1_2/MailArchiver/2.2/mobile/setup/setup.inc.php
r4350 r4644 14 14 $setup_info['mobile']['name'] = 'mobile'; 15 15 $setup_info['mobile']['title'] = 'Expresso Mini'; 16 $setup_info['mobile']['version'] = '2.2. 3';16 $setup_info['mobile']['version'] = '2.2.4'; 17 17 $setup_info['mobile']['app_order'] = 4; 18 18 $setup_info['mobile']['enable'] = 2; -
sandbox/expressoMail1_2/MailArchiver/2.2/news_admin/inc/class.sonews.inc.php
r49 r4644 44 44 45 45 $sql = 'SELECT * FROM phpgw_news WHERE news_cat ' . $filter; 46 $sql_count = 'SELECT count(*) as total FROM phpgw_news WHERE news_cat ' . $filter; 46 47 if($activeonly) 47 48 { 48 49 $now = time(); 49 $sql .= " AND news_begin<=$now AND news_end>=$now"; 50 $filter_plus = " AND news_begin<=$now AND news_end>=$now"; 51 $sql .= $filter_plus; 52 $sql_count.= $filter_plus; 50 53 } 51 54 $sql .= $ordermethod; 52 55 53 $this->db->query($sql,__LINE__,__FILE__); 54 $total = $this->db->num_rows(); 56 $this->db->query($sql_count,__LINE__,__FILE__); 57 if($this->db->next_record()) 58 $total = $this->db->f('total'); 59 else 60 $total=0; 55 61 $this->db->limit_query($sql,$start,__LINE__,__FILE__,$limit); 56 62 -
sandbox/expressoMail1_2/MailArchiver/2.2/phpgwapi/js/browser/browserDetect.js
r4423 r4644 15 15 is_major = parseInt(is_minor); 16 16 } 17 17 18 18 //Konqueror 19 19 20 20 var is_konq = false; 21 21 var kqPos = agt.indexOf('konqueror'); … … 54 54 // Chrome 55 55 ['chrome8', ( agt.indexOf('chrome/8') != -1 ) ], 56 ['chrome11', ( agt.indexOf('chrome/11') != -1 ) ], 56 57 57 58 // EPIPHANY … … 63 64 ['firefox3', ( agt.indexOf('firefox/3') != -1 ) ], 64 65 ['firefox4', ( agt.indexOf('firefox/4') != -1 ) ], 66 ['firefox5', ( agt.indexOf('firefox/5') != -1 ) ], 67 65 68 66 69 // ICEWEASEL … … 95 98 96 99 // IS SAFARI/KHTML 97 ['safari', ( (agt.indexOf('safari')!=-1) && (agt.indexOf('mac')!=-1)) ],100 ['safari', ( agt.indexOf('safari') != -1 ) ], 98 101 ['khtml', is_khtml ] 99 102 ]; -
sandbox/expressoMail1_2/MailArchiver/2.2/phpgwapi/js/x_tools
-
Property
svn:ignore
set to
.xtools.js.swp
-
Property
svn:ignore
set to
-
sandbox/expressoMail1_2/MailArchiver/2.2/phpgwapi/js/x_tools/xtools.js
r4434 r4644 17 17 { 18 18 var parser = new DOMParser(); 19 var _xmlDoc = parser.parseFromString( pString, "text/xml");19 var _xmlDoc = parser.parseFromString(pString, "text/xml"); 20 20 } 21 21 … … 31 31 { 32 32 var _data = null; 33 34 if ( document.implementation.createDocument ) 33 if ( document.implementation && document.implementation.createDocument ) 35 34 { 36 var xmlHttp = new window.XMLHttpRequest(); 37 xmlHttp.open("GET",pFile + '?' + Date.parse(new Date),false ); 38 xmlHttp.send(null); 39 40 _data = xmlHttp.responseXML.documentElement; 35 XMLDocument.prototype.load = function(filePath) 36 { 37 var xmlhttp = new XMLHttpRequest(); 38 xmlhttp.open("GET", filePath, false); 39 xmlhttp.setRequestHeader("Content-Type","text/xml"); 40 xmlhttp.send(null); 41 var newDOM = xmlhttp.responseXML; 42 if( newDOM ) 43 { 44 var newElt = this.importNode(newDOM.documentElement, true); 45 this.appendChild(newElt); 46 return true; 47 } 48 } 49 50 _data = document.implementation.createDocument("", "", null); 41 51 } 42 52 else 43 { 44 _data = new ActiveXObject( "Msxml2.FreeThreadedDOMDocument" ); 45 _data.async = false; 46 _data.load( pFile + '?' + Date.parse(new Date) ); 47 } 53 _data = new ActiveXObject("Msxml2.FreeThreadedDOMDocument"); 48 54 55 _data.async = false; 56 _data.load( pFile + '?' + Date.parse(new Date)); 49 57 _FILES[pFile] = _data; 50 58 } … … 64 72 pXSL = arguments[1]; 65 73 } 66 67 74 switch ( typeof pXML ) 68 75 { … … 76 83 break; 77 84 default : 78 return { 'error' : 'invalid xml' }85 return {'error':'invalid xml'} 79 86 } 80 81 87 switch ( typeof pXSL ) 82 88 { … … 91 97 92 98 var fragment = null; 93 94 99 if ( window.XSLTProcessor ) 95 100 { … … 101 106 var params = arguments[2]; 102 107 for (var i in params ) 103 if ( params[ i ] && params[ i ].constructor != Function ) 104 xslProc.setParameter(null, String( i ), String( params[i] ) ); 108 xslProc.setParameter(null, i, params[i]); 105 109 } 106 110 107 111 fragment = xslProc.transformToFragment(pXML, document); 108 112 109 // para retornar valor igual ao ie.110 113 var aux = document.createElement("div"); 111 aux.appendChild( fragment);114 aux.appendChild( fragment ); 112 115 fragment = aux.innerHTML; 113 116 } … … 124 127 var params = arguments[2]; 125 128 for (var i in params ) 126 if ( params[ i ] && params[ i ].constructor != Function ) 127 { 128 xslProc.addParameter( String( i ), String( params[i] ), ''); 129 } 129 xslProc.addParameter(i, params[i], ''); 130 130 } 131 131 … … 155 155 { 156 156 var _argv = arguments; 157 this._PATH = ( _argv.length > 0 ) ? _argv[0] : '';158 157 this._PATH = ( _argv.length > 0 ) ? 158 _argv[0] : ''; 159 159 if ( this._PATH != '' && this._PATH.lastIndexOf('/') != (this._PATH.length - 1) ) 160 160 this._PATH += '/'; 161 161 } 162 162 163 163 xtools.prototype.convert = _convert; 164 164 xtools.prototype.load = _load; 165 165 xtools.prototype.parse = _parse; -
sandbox/expressoMail1_2/MailArchiver/2.2/phpgwapi/setup/setup.inc.php
r4350 r4644 14 14 $setup_info['phpgwapi']['name'] = 'phpgwapi'; 15 15 $setup_info['phpgwapi']['title'] = 'API'; 16 $setup_info['phpgwapi']['version'] = '2.2. 3';16 $setup_info['phpgwapi']['version'] = '2.2.4'; 17 17 $setup_info['phpgwapi']['versions']['current_header'] = '2.2'; 18 18 $setup_info['phpgwapi']['enable'] = 3; -
sandbox/expressoMail1_2/MailArchiver/2.2/phpgwapi/setup/tables_update.inc.php
r4350 r4644 127 127 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 128 128 } 129 $test[] = '2.2.3'; 130 function phpgwapi_upgrade2_2_3() 131 { 132 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.2.4'; 133 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 134 } 129 135 ?> -
sandbox/expressoMail1_2/MailArchiver/2.2/reports/inc/class.functions.inc.php
r4033 r4644 24 24 'array_invert' => True, 25 25 'Paginate_user' => True, 26 'Paginate_cota' => True, 27 'Paginate_shareAccount' => True, 28 'Paginate_institutionalAccount' => True, 26 29 'Paginate_user_logon' => True, 27 30 'get_list_all' => True, … … 854 857 } 855 858 859 function get_list_cota_sector($query, $contexts,$sizelimit) 860 { 861 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 862 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 863 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 864 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 865 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 866 ldap_bind($ldap_conn,$dn,$passwd); 867 868 $filter="(|(phpgwAccountType=u)(|(phpgwAccountType=s)))"; 869 $justthese = array("uidnumber", "uid", "cn", "mail","accountstatus","dn","createtimestamp","telephoneNumber"); 870 871 $tmp = array(); 872 873 foreach ($contexts as $index=>$context) 874 { 875 876 $search = ldap_search($ldap_conn, $query, $filter, $justthese, 0, $sizelimit); 877 $info = ldap_get_entries($ldap_conn, $search); 878 879 for ($i=0; $i < $info['count']; $i++) 880 { 881 $tmp[$info[$i]['uid'][0]]['account_id'] = $info[$i]['uidnumber'][0]; 882 $tmp[$info[$i]['uid'][0]]['account_lid'] = $info[$i]['uid'][0]; 883 $tmp[$info[$i]['uid'][0]]['account_cn'] = $info[$i]['cn'][0]; 884 $tmp[$info[$i]['uid'][0]]['account_mail']= $info[$i]['mail'][0]; 885 $tmp[$info[$i]['uid'][0]]['account_phone']= $info[$i]['telephonenumber'][0]; 886 $tmp[$info[$i]['uid'][0]]['account_accountstatus']= $info[$i]['accountstatus'][0]; 887 $tmp[$info[$i]['uid'][0]]['createtimestamp']= $info[$i]['createtimestamp'][0]; 888 $sort[] = $info[$i]['uid'][0]; 889 } 890 } 891 892 ldap_close($ldap_conn); 893 894 if (count($sort)) 895 { 896 natcasesort($sort); 897 foreach ($sort as $user_uid) 898 $return[$user_uid] = $tmp[$user_uid]; 899 } 900 901 return $return; 902 903 } 904 905 906 function get_list_shareAccounts_sector($query, $contexts,$sizelimit) 907 { 908 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 909 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 910 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 911 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 912 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 913 ldap_bind($ldap_conn,$dn,$passwd); 914 915 $filter="(phpgwAccountType=s)"; 916 $justthese = array("uid", "cn", "mail","accountstatus"); 917 918 $tmp = array(); 919 920 foreach ($contexts as $index=>$context) 921 { 922 923 $search = ldap_search($ldap_conn, $query, $filter, $justthese, 0, $sizelimit); 924 $info = ldap_get_entries($ldap_conn, $search); 925 926 for ($i=0; $i < $info['count']; $i++) 927 { 928 $tmp[$info[$i]['uid'][0]]['account_lid'] = $info[$i]['uid'][0]; 929 $tmp[$info[$i]['uid'][0]]['account_cn'] = $info[$i]['cn'][0]; 930 $tmp[$info[$i]['uid'][0]]['account_mail']= $info[$i]['mail'][0]; 931 $tmp[$info[$i]['uid'][0]]['account_accountstatus']= $info[$i]['accountstatus'][0]; 932 $sort[] = $info[$i]['uid'][0]; 933 } 934 } 935 936 ldap_close($ldap_conn); 937 938 if (count($sort)) 939 { 940 natcasesort($sort); 941 foreach ($sort as $user_uid) 942 $return[$user_uid] = $tmp[$user_uid]; 943 } 944 945 return $return; 946 } 947 948 function get_list_institutionalAccounts_sector($query, $contexts,$sizelimit) 949 { 950 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 951 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 952 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 953 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 954 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 955 ldap_bind($ldap_conn,$dn,$passwd); 956 957 $filter="(phpgwAccountType=i)"; 958 $justthese = array("uid", "cn", "mail","accountstatus","mailForwardingAddress"); 959 960 $tmp = array(); 961 962 foreach ($contexts as $index=>$context) 963 { 964 965 $search = ldap_search($ldap_conn, $query, $filter, $justthese, 0, $sizelimit); 966 $info = ldap_get_entries($ldap_conn, $search); 967 968 for ($i=0; $i < $info['count']; $i++) 969 { 970 $tmp[$info[$i]['uid'][0]]['account_cn'] = $info[$i]['cn'][0]; 971 $tmp[$info[$i]['uid'][0]]['account_mail']= $info[$i]['mail'][0]; 972 $tmp[$info[$i]['uid'][0]]['account_accountstatus']= $info[$i]['accountstatus'][0]; 973 $tmp[$info[$i]['uid'][0]]['account_mailforwardingaddress']= $info[$i]['mailforwardingaddress']; 974 $sort[] = $info[$i]['uid'][0]; 975 } 976 } 977 978 ldap_close($ldap_conn); 979 980 if (count($sort)) 981 { 982 natcasesort($sort); 983 foreach ($sort as $user_uid) 984 $return[$user_uid] = $tmp[$user_uid]; 985 } 986 987 return $return; 988 } 989 856 990 function get_count_user_sector($query, $contexts,$sizelimit) 857 991 { … … 871 1005 $entries = ldap_get_entries($ldap_conn, $search); 872 1006 $contexts = array(); 873 for ($i=0; $i< $entries['count']; $i++){874 $contexts[] = $entries[$i]['dn'];875 1007 } 876 1008 } 1009 1010 $filter="(phpgwAccountType=u)"; 1011 $justthese = array("dn"); 1012 $search = ldap_search($ldap_conn, $context, $filter, $justthese, 0, $sizelimit); 1013 $entries = ldap_get_entries($ldap_conn, $search); 1014 $total_count = $entries["count"]; 1015 1016 ldap_close($ldap_conn); 1017 1018 return $total_count; 877 1019 } 878 $filter="(&(phpgwAccountType=u)(|(uid=*)))"; 879 $justthese = array("uidnumber"); 880 $total_count = 0; 881 1020 1021 function get_count_cota_sector($query, $contexts,$sizelimit) 1022 { 1023 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 1024 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 1025 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 1026 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 1027 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 1028 ldap_bind($ldap_conn,$dn,$passwd); 1029 // counting users by sector. 882 1030 foreach ($contexts as $index=>$context) { 1031 if($context == $GLOBALS['phpgw_info']['server'] ["ldap_context"]) { 1032 $contexts[$index] = null; 1033 $justthese = array("dn"); 1034 $filter="(objectClass=OrganizationalUnit)"; 1035 $search = ldap_list($ldap_conn, $context, $filter, $justthese); 1036 $entries = ldap_get_entries($ldap_conn, $search); 1037 $contexts = array(); 1038 } 1039 } 1040 1041 $filter="(|(phpgwAccountType=u)(|(phpgwAccountType=s)))"; 1042 $justthese = array("dn"); 883 1043 $search = ldap_search($ldap_conn, $context, $filter, $justthese, 0, $sizelimit); 884 $total_count += ldap_count_entries($ldap_conn, $search); 885 } 1044 $entries = ldap_get_entries($ldap_conn, $search); 1045 $total_count = $entries["count"]; 1046 1047 ldap_close($ldap_conn); 1048 1049 return $total_count; 1050 } 1051 1052 function get_count_shareAccount_sector($query, $contexts,$sizelimit) 1053 { 1054 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 1055 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 1056 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 1057 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 1058 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 1059 ldap_bind($ldap_conn,$dn,$passwd); 1060 // counting users by sector. 1061 foreach ($contexts as $index=>$context) { 1062 if($context == $GLOBALS['phpgw_info']['server'] ["ldap_context"]) { 1063 $contexts[$index] = null; 1064 $justthese = array("dn"); 1065 $filter="(objectClass=OrganizationalUnit)"; 1066 $search = ldap_list($ldap_conn, $context, $filter, $justthese); 1067 $entries = ldap_get_entries($ldap_conn, $search); 1068 $contexts = array(); 1069 } 1070 } 1071 1072 $filter="(phpgwAccountType=s)"; 1073 $justthese = array("dn"); 1074 $search = ldap_search($ldap_conn, $context, $filter, $justthese, 0, $sizelimit); 1075 $entries = ldap_get_entries($ldap_conn, $search); 1076 $total_count = $entries["count"]; 1077 1078 ldap_close($ldap_conn); 1079 1080 return $total_count; 1081 } 1082 1083 function get_count_institutionalAccount_sector($query, $contexts,$sizelimit) 1084 { 1085 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 1086 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 1087 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 1088 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 1089 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 1090 ldap_bind($ldap_conn,$dn,$passwd); 1091 // counting users by sector. 1092 foreach ($contexts as $index=>$context) { 1093 if($context == $GLOBALS['phpgw_info']['server'] ["ldap_context"]) { 1094 $contexts[$index] = null; 1095 $justthese = array("dn"); 1096 $filter="(objectClass=OrganizationalUnit)"; 1097 $search = ldap_list($ldap_conn, $context, $filter, $justthese); 1098 $entries = ldap_get_entries($ldap_conn, $search); 1099 $contexts = array(); 1100 } 1101 } 1102 1103 $filter="(phpgwAccountType=i)"; 1104 $justthese = array("dn"); 1105 $search = ldap_search($ldap_conn, $context, $filter, $justthese, 0, $sizelimit); 1106 $entries = ldap_get_entries($ldap_conn, $search); 1107 $total_count = $entries["count"]; 1108 886 1109 ldap_close($ldap_conn); 1110 887 1111 return $total_count; 888 1112 } … … 897 1121 ldap_bind($ldap_conn,$dn,$passwd); 898 1122 899 $filter="( &(phpgwAccountType=u)(|(uid=*)))";1123 $filter="(phpgwAccountType=u)"; 900 1124 $justthese = array("uidnumber", "uid", "cn", "mail","accountstatus","dn","createtimestamp"); 901 1125 … … 1254 1478 ldap_bind($ldap_conn,$dn,$passwd); 1255 1479 1256 $filter="(&(phpgwAccountType=u) (|(uid=*)))";1480 $filter="(&(phpgwAccountType=u))"; 1257 1481 $justthese = array("uidnumber", "uid", "cn", "mail","accountstatus","dn","createtimestamp","telephoneNumber"); 1258 1482 … … 1318 1542 return $sOrder === "desc" ? array_reverse( $aList ) : $aList; 1319 1543 } 1544 1545 function Paginate_cota($type, $query, $contexts, $Field, $Order = 'asc', $Page = null, $PerPage = null ) 1546 { 1547 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 1548 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 1549 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 1550 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 1551 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 1552 ldap_bind($ldap_conn,$dn,$passwd); 1553 1554 $filter="(|(phpgwAccountType=u)(|(phpgwAccountType=s)))"; 1555 $justthese = array("uidnumber", "uid", "cn", "mail","accountstatus","dn","createtimestamp","telephoneNumber"); 1556 1557 foreach ($contexts as $index=>$context) 1558 { 1559 $search=ldap_search($ldap_conn, $query, $filter, $justthese); 1560 1561 $rConnection = $ldap_conn; 1562 $rSearch = $search; 1563 $sOrder = $Order; 1564 $iPage = $Page; 1565 $iPerPage = $PerPage; 1566 $sField = $Field; 1567 1568 $iTotalEntries = ldap_count_entries( $rConnection, $rSearch ); 1569 1570 if ( $iPage === null || $iPerPage === null ) 1571 { 1572 # fetch all in one page 1573 $iStart = 0; 1574 $iEnd = $iTotalEntries - 1; 1575 } 1576 else 1577 { 1578 # calculate range of page 1579 $iFimPage = ( ceil( $iTotalEntries / $iPerPage ) - 1 ) * $iPage; 1580 1581 $iStart = ( ceil( ($iPage -1) * $iPerPage )); 1582 $iEnd = $iPage * $iPerPage; 1583 1584 1585 if ( $sOrder === "desc" ) 1586 { 1587 # revert range 1588 $iStart = $iTotalEntries - 1 - $iEnd; 1589 $iEnd = $iStart + $iPerPage - 1; 1590 } 1591 } 1592 1593 /********* Importante Mostra o resultado da paginação ********** 1594 var_dump( $iStart . " " . $iEnd ); 1595 ****************** Só descomentar ******************************/ 1596 1597 # fetch entries 1598 ldap_sort( $rConnection, $rSearch, $sField ); 1599 1600 $aList = array(); 1601 for ( 1602 $iCurrent = 0, $rEntry = ldap_first_entry( $rConnection, $rSearch ); 1603 $iCurrent <= $iEnd && is_resource( $rEntry ); 1604 $iCurrent++, $rEntry = ldap_next_entry( $rConnection, $rEntry ) 1605 ) 1606 { 1607 if ( $iCurrent >= $iStart ) 1608 { 1609 array_push( $aList, ldap_get_attributes( $rConnection, $rEntry )); 1610 } 1611 } 1612 } 1613 1614 ldap_close($ldap_conn); 1615 1616 # if order is desc revert page's entries 1617 return $sOrder === "desc" ? array_reverse( $aList ) : $aList; 1618 } 1619 1620 function Paginate_shareAccount($type, $query, $contexts, $Field, $Order = 'asc', $Page = null, $PerPage = null ) 1621 1622 { 1623 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 1624 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 1625 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 1626 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 1627 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 1628 ldap_bind($ldap_conn,$dn,$passwd); 1629 1630 $filter="(phpgwAccountType=s)"; 1631 $justthese = array("uid", "cn", "mail","accountstatus"); 1632 1633 foreach ($contexts as $index=>$context) 1634 { 1635 $search=ldap_search($ldap_conn, $query, $filter, $justthese); 1636 1637 $rConnection = $ldap_conn; 1638 $rSearch = $search; 1639 $sOrder = $Order; 1640 $iPage = $Page; 1641 $iPerPage = $PerPage; 1642 $sField = $Field; 1643 1644 $iTotalEntries = ldap_count_entries( $rConnection, $rSearch ); 1645 1646 if ( $iPage === null || $iPerPage === null ) 1647 { 1648 # fetch all in one page 1649 $iStart = 0; 1650 $iEnd = $iTotalEntries - 1; 1651 } 1652 else 1653 { 1654 # calculate range of page 1655 $iFimPage = ( ceil( $iTotalEntries / $iPerPage ) - 1 ) * $iPage; 1656 1657 $iStart = ( ceil( ($iPage -1) * $iPerPage )); 1658 $iEnd = $iPage * $iPerPage; 1659 1660 if ( $sOrder === "desc" ) 1661 { 1662 # revert range 1663 $iStart = $iTotalEntries - 1 - $iEnd; 1664 $iEnd = $iStart + $iPerPage - 1; 1665 } 1666 } 1667 1668 # fetch entries 1669 ldap_sort( $rConnection, $rSearch, $sField ); 1670 1671 $aList = array(); 1672 for ( 1673 $iCurrent = 0, $rEntry = ldap_first_entry( $rConnection, $rSearch ); 1674 $iCurrent <= $iEnd && is_resource( $rEntry ); 1675 $iCurrent++, $rEntry = ldap_next_entry( $rConnection, $rEntry ) 1676 ) 1677 { 1678 if ( $iCurrent >= $iStart ) 1679 { 1680 array_push( $aList, ldap_get_attributes( $rConnection, $rEntry )); 1681 } 1682 } 1683 } 1684 1685 ldap_close($ldap_conn); 1686 1687 # if order is desc revert page's entries 1688 return $sOrder === "desc" ? array_reverse( $aList ) : $aList; 1689 } 1690 1691 function Paginate_institutionalAccount($type, $query, $contexts, $Field, $Order = 'asc', $Page = null, $PerPage = null ) 1692 { 1693 $dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 1694 $passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 1695 $ldap_conn = ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 1696 ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3); 1697 ldap_set_option($ldap_conn, LDAP_OPT_REFERRALS, 0); 1698 ldap_bind($ldap_conn,$dn,$passwd); 1699 1700 $filter="(phpgwAccountType=i)"; 1701 $justthese = array("uid", "cn", "mail","accountstatus","mailforwardingaddress"); 1702 1703 foreach ($contexts as $index=>$context) 1704 { 1705 $search=ldap_search($ldap_conn, $query, $filter, $justthese); 1706 1707 $rConnection = $ldap_conn; 1708 $rSearch = $search; 1709 $sOrder = $Order; 1710 $iPage = $Page; 1711 $iPerPage = $PerPage; 1712 $sField = $Field; 1713 1714 $iTotalEntries = ldap_count_entries( $rConnection, $rSearch ); 1715 1716 if ( $iPage === null || $iPerPage === null ) 1717 { 1718 # fetch all in one page 1719 $iStart = 0; 1720 $iEnd = $iTotalEntries - 1; 1721 } 1722 else 1723 { 1724 # calculate range of page 1725 $iFimPage = ( ceil( $iTotalEntries / $iPerPage ) - 1 ) * $iPage; 1726 1727 $iStart = ( ceil( ($iPage -1) * $iPerPage )); 1728 $iEnd = $iPage * $iPerPage; 1729 1730 if ( $sOrder === "desc" ) 1731 { 1732 # revert range 1733 $iStart = $iTotalEntries - 1 - $iEnd; 1734 $iEnd = $iStart + $iPerPage - 1; 1735 } 1736 } 1737 1738 # fetch entries 1739 ldap_sort( $rConnection, $rSearch, $sField ); 1740 1741 $aList = array(); 1742 for ( 1743 $iCurrent = 0, $rEntry = ldap_first_entry( $rConnection, $rSearch ); 1744 $iCurrent <= $iEnd && is_resource( $rEntry ); 1745 $iCurrent++, $rEntry = ldap_next_entry( $rConnection, $rEntry ) 1746 ) 1747 { 1748 if ( $iCurrent >= $iStart ) 1749 { 1750 array_push( $aList, ldap_get_attributes( $rConnection, $rEntry )); 1751 } 1752 } 1753 } 1754 1755 ldap_close($ldap_conn); 1756 1757 # if order is desc revert page's entries 1758 return $sOrder === "desc" ? array_reverse( $aList ) : $aList; 1759 } 1760 1320 1761 1321 1762 function get_list_ou_user_logon($query,$contexts,$sizelimit) -
sandbox/expressoMail1_2/MailArchiver/2.2/reports/inc/class.imap_functions.inc.php
r3946 r4644 39 39 return $quota; 40 40 } 41 42 function getMembersShareAccount($uid) 43 { 44 $owner_user_share = imap_getacl($this->imap, "user" . $this->imapDelimiter . $uid); 45 46 //Organiza participantes da conta compartilha em um array, retira apenas os members, 47 $i =0; 48 foreach($owner_user_share as $key => $value) 49 { 50 if ($i != 0) 51 { 52 $return[$i] = $key; 53 } 54 $i++; 55 } 56 57 //Ordena os participantes da conta compartilhada 58 sort($return); 59 60 return $return; 61 } 62 41 63 } -
sandbox/expressoMail1_2/MailArchiver/2.2/reports/inc/class.uireports_cota.inc.php
r4035 r4644 38 38 $this->imap_functions = CreateObject('reports.imap_functions'); 39 39 $this->fpdf = CreateObject('reports.uireports_fpdf'); // Class para PDF 40 // $this->fpdf = CreateObject('reports.fpdf'); // Class para PDF41 40 42 41 $c = CreateObject('phpgwapi.config','reports'); // cria o objeto relatorio no $c … … 157 156 { 158 157 // Conta a quantidade de Usuario do grupo raiz 159 $account_user = $this->functions->get_count_ user_sector($contextsdn,$contexts,0);158 $account_user = $this->functions->get_count_cota_sector($contextsdn,$contexts,0); 160 159 $totaluser = "(".$account_user.")"; 161 160 … … 277 276 278 277 // verifica se exixte usuarios no LDAP 279 $account_info = $this->functions->get_list_ user_sector ($setordn,$contexts,0);278 $account_info = $this->functions->get_list_cota_sector ($setordn,$contexts,0); 280 279 281 280 if (!count($account_info)) … … 357 356 358 357 // ********** busca no LDAP as informação paginada e imprime **************** 359 $paginas = $this->functions->Paginate_ user('accounts',$setordn,$contexts,'cn','asc',$npag,$numpage);358 $paginas = $this->functions->Paginate_cota('accounts',$setordn,$contexts,'cn','asc',$npag,$numpage); 360 359 361 360 $tmpp = array(); … … 418 417 'row_cn' => $accountr['account_cn'], 419 418 'percent_cota' => $percent_cota_c, 420 'row_status' => $accountr['account_status'] == 'active' ? '<font color="#0033FF"> Ativado</font> ' : '<font color="#FF0000">Desativado</font>',421 'row_mail' => (!$accountr['account_mail']?'<font color=red> Sem E-mail</font>':$accountr['account_mail'])419 'row_status' => $accountr['account_status'] == 'active' ? '<font color="#0033FF">'.lang('Activated').'</font> ' : '<font color="#FF0000">'.lang('Disabled').'</font>', 420 'row_mail' => (!$accountr['account_mail']?'<font color=red>'.lang('Without E-mail').'</font>':$accountr['account_mail']) 422 421 ); 423 422 … … 526 525 $pdf->Open(); 527 526 $pdf->AddPage(); 528 $pdf->SetTitle('Relatório Gerado pelo Expresso Reports');529 527 530 528 //Set font and colors … … 537 535 //Table header 538 536 $SubTitulo = lang('reports title4'); 539 $SubTituloR = lang(' report cota organization');537 $SubTituloR = lang('Report Generated by Expresso Reports'); 540 538 $SubTitulo1 = $subtitulo1; 541 539 $GLOBALS['phpgw_info']['apps']['reports']['subtitle'] = $SubTituloR; … … 550 548 $pdf->SetLineWidth(.3); 551 549 552 // $pdf->Cell(0,10,$SubTitulo1,0,1,'C',0);553 550 $pdf->MultiCell(0,3,$SubTitulo1,0,'C',0); 554 551 … … 558 555 $pdf->Cell(0,5,$titulo_system,0,1,'R',0); 559 556 560 $account_info = $this->functions->get_list_ user_sector($setordn,$contexts,0);557 $account_info = $this->functions->get_list_cota_sector($setordn,$contexts,0); 561 558 562 559 if (count($account_info)) … … 596 593 $account_lid = $account['account_lid']; 597 594 $row_cn = $account['account_cn']; 598 $row_mail = (!$account['account_mail']?'<font color=red> Sem E-mail</font>':$account['account_mail']);595 $row_mail = (!$account['account_mail']?'<font color=red>'.lang('Without E-mail').'</font>':$account['account_mail']); 599 596 $row_mailquota = $user_mailquota; 600 597 $row_mailquota_used = $user_mailquota_used; 601 598 $row_percent_cota = $percent_cota; 602 $row_status = $account['account_accountstatus'] == 'active' ? 'Ativado' : 'Desativado';599 $row_status = $account['account_accountstatus'] == 'active' ? lang('Activated') : lang('Disabled'); 603 600 604 601 … … 656 653 function get_user_info($userdn,$usercontexts,$usersizelimit) 657 654 { 658 // $user_info = $this->functions->Paginate_user('accounts',$setordn,$contexts,'cn','asc',$npag,$numpage);659 655 $user_info_imap = $this->imap_functions->get_user_info($user_info_ldap['uid']); 660 656 -
sandbox/expressoMail1_2/MailArchiver/2.2/reports/inc/class.uireports_fpdf.inc.php
r3666 r4644 120 120 } 121 121 122 /* function Header()123 {124 $SubTituloR = lang('report cota organization');125 126 //Restore font and colors127 $this->SetFont('Arial','',8);128 $this->SetFillColor(224,235,255);129 $this->SetTextColor(0);130 131 $this->Cell(95,5,lang('name'),1,0,'L',1);132 // $pdf->Cell(53,5,lang('report email'),1,0,'L',1);133 $this->Cell(17,5,lang('cota'),1,0,'C',1);134 $this->Cell(31,5,lang('cota used'),1,0,'C',1);135 $this->Cell(29,5,lang('percent cota'),1,0,'C',1);136 $this->Cell(20,5,lang('status'),1,1,'C',1);137 138 return;139 }140 */141 122 function Footer() 142 123 { 143 124 // Esta função foi implemantada para realizar o rodapé dos relatórios 144 145 125 $titulo_system = $GLOBALS['phpgw_info']['apps']['reports']['title']; 146 126 $SubTitulo = $GLOBALS['phpgw_info']['apps']['reports']['subtitle']; … … 153 133 154 134 //Imprime o número da página 155 // $this->Cell(0,5,$titulo_system.' '.$SubTitulo.' Página n. '.$this->PageNo(),1,0,'C',1);156 157 135 $this->Rect(9,281,197,6,'D'); 158 136 $this->Cell(55,4,$titulo_system,0,0,'L',1); -
sandbox/expressoMail1_2/MailArchiver/2.2/reports/inc/class.uireports_logon.inc.php
r4035 r4644 76 76 77 77 if ($vnumacesso==999){ 78 $numacesso = "Nunca logou";78 $numacesso = lang('Never login'); 79 79 } 80 80 … … 87 87 $pdf->Open(); 88 88 $pdf->AddPage(); 89 $pdf->SetTitle('Relatório Gerado pelo Expresso Reports');90 89 91 90 //Set font and colors … … 98 97 //Table header 99 98 $SubTitulo = lang('reports title6'); 100 $SubTituloR = lang(' report of time without logging by Organization');99 $SubTituloR = lang('Report Generated by Expresso Reports'); 101 100 $SubTitulo1 = $subtitulo1; 102 101 $GLOBALS['phpgw_info']['apps']['reports']['subtitle'] = $SubTituloR; … … 181 180 $row_cn = $accountr['account_cn']; 182 181 $account_lid = $accountr['account_lid']; 183 $row_mail = (!$accountr['account_mail'] ? 'Sem E-mail': $accountr['account_mail']);182 $row_mail = (!$accountr['account_mail'] ? lang('Without E-mail') : $accountr['account_mail']); 184 183 $row_timestamp = substr($accountr['createTimestamp'], 6, 2)."/".substr($accountr['createTimestamp'], 4, 2)."/".substr($accountr['createTimestamp'], 0, 4); 185 $row_li_date = $accountr['li_date'] == 'Nunca logou' ? 'Nunca logou': $accountr['li_date'];184 $row_li_date = $accountr['li_date'] == lang('Never login') ? lang('Never login') : $accountr['li_date']; 186 185 $row_li_dias = $accountr['li_dias']; 187 $row_status = $accountr['account_status'] == 'active' ? 'Ativado' : 'Desativado';186 $row_status = $accountr['account_status'] == 'active' ? lang('Activated') : lang('Disabled'); 188 187 189 188 $pdf->Cell(60,5,$account_lid,0,0,'L',0); … … 192 191 $pdf->Cell(25,5,$row_timestamp,0,0,'C',0); 193 192 194 if ($row_li_date == 'Nunca logou')193 if ($row_li_date == lang('Never login')) 195 194 { 196 195 //Muda cor fonte … … 612 611 'row_mail' => (!$accountr['account_mail']?'<font color=red>Sem E-mail</font>':$accountr['account_mail']), 613 612 'row_timestamp' => substr($accountr['createTimestamp'], 6, 2)."/".substr($accountr['createTimestamp'], 4, 2)."/".substr($accountr['createTimestamp'], 0, 4), 614 'row_li_date' => $accountr['li_date'] == 'Nunca logou'? '<font color="#FF0000">'.$accountr['li_date'].'</font>' : $accountr['li_date'],613 'row_li_date' => $accountr['li_date'] ==lang('Never login') ? '<font color="#FF0000">'.$accountr['li_date'].'</font>' : $accountr['li_date'], 615 614 'row_li_dias' => $accountr['li_dias'] 616 615 ); … … 718 717 $access_log_array = explode("#",$access_log); 719 718 720 if ($numacesso<> "Nunca logou"){719 if ($numacesso<>lang('Never login')){ 721 720 $accountp['li_dias'] = $access_log_array[1]; 722 721 $accountp['li_date'] = $access_log_array[0]; … … 778 777 'row_loginid' => $accountr['account_lid'], 779 778 'row_cn' => $accountr['account_cn'], 780 'row_status' => $accountr['account_status'] == 'active' ? '<font color="#0033FF"> Ativado</font> ' : '<font color="#FF0000">Desativado</font>',781 'row_mail' => (!$accountr['account_mail']?'<font color=red> Sem E-mail</font>':$accountr['account_mail']),779 'row_status' => $accountr['account_status'] == 'active' ? '<font color="#0033FF">'.lang('Activated').'</font> ' : '<font color="#FF0000">'.lang('Disabled').'</font>', 780 'row_mail' => (!$accountr['account_mail']?'<font color=red>'.lang('Without E-mail').'</font>':$accountr['account_mail']), 782 781 'row_timestamp' => substr($accountr['createTimestamp'], 6, 2)."/".substr($accountr['createTimestamp'], 4, 2)."/".substr($accountr['createTimestamp'], 0, 4), 783 'row_li_date' => $accountr['li_date'] == 'Nunca logou'? '<font color="#FF0000">'.$accountr['li_date'].'</font>' : $accountr['li_date'],782 'row_li_date' => $accountr['li_date'] ==lang('Never login') ? '<font color="#FF0000">'.$accountr['li_date'].'</font>' : $accountr['li_date'], 784 783 'row_li_dias' => $accountr['li_dias'] 785 784 ); -
sandbox/expressoMail1_2/MailArchiver/2.2/reports/inc/class.uireports_maillists.inc.php
r4035 r4644 78 78 $pdf->Open(); 79 79 $pdf->AddPage(); 80 $pdf->SetTitle( 'Relatório Gerado pelo Expresso Reports');80 $pdf->SetTitle(lang('Report Generated by Expresso Reports')); 81 81 82 82 //Set font and colors … … 89 89 //Table header 90 90 $SubTitulo = lang('reports title8'); 91 $SubTituloR = lang(' report organization');91 $SubTituloR = lang('Report Generated by Expresso Reports'); 92 92 $SubTitulo1 = $subtitulo1; 93 93 $GLOBALS['phpgw_info']['apps']['reports']['subtitle'] = $SubTituloR; … … 125 125 $row_loginid = $account['uid']; 126 126 $row_cn = $account['name']; 127 $row_mail = (!$account['email']?'<font color=red> Sem E-mail</font>':$account['email']);127 $row_mail = (!$account['email']?'<font color=red>'.lang('Without E-mail').'</font>':$account['email']); 128 128 $pdf->Cell(40,5,$row_loginid,0,0,'L',0); 129 129 $pdf->Cell(75,5,$row_cn,0,0,'L',0); … … 461 461 $tmpp[$accountp['uid'][0]]['account_lid'] = $accountp['uid'][0]; 462 462 $tmpp[$accountp['uid'][0]]['account_cn'] = $accountp['cn'][0]; 463 $tmpp[$accountp['uid'][0]]['account_mail'] = $accountp['mail'][0];463 $tmpp[$accountp['uid'][0]]['account_mail'] = $accountp['mail'][0]; 464 464 $sortp[] = $accountp['uid'][0]; 465 465 if (count($sortp)) … … 478 478 'row_loginid' => $accountr['account_lid'], 479 479 'row_cn' => $accountr['account_cn'], 480 'row_mail' => (!$accountr['account_mail']?'<font color=red> Sem E-mail</font>':$accountr['account_mail'])480 'row_mail' => (!$accountr['account_mail']?'<font color=red>'.lang('Without E-mail').'</font>':$accountr['account_mail']) 481 481 ); 482 482 -
sandbox/expressoMail1_2/MailArchiver/2.2/reports/inc/class.uireports_users.inc.php
r4035 r4644 78 78 $pdf->Open(); 79 79 $pdf->AddPage(); 80 $pdf->SetTitle( 'Relatório Gerado pelo Expresso Reports');80 $pdf->SetTitle(lang('Report Generated by Expresso Reports')); 81 81 82 82 //Set font and colors … … 89 89 //Table header 90 90 $SubTitulo = lang('reports title2'); 91 $SubTituloR = lang(' report organization');91 $SubTituloR = lang('Report Generated by Expresso Reports'); 92 92 $SubTitulo1 = $subtitulo1; 93 93 $GLOBALS['phpgw_info']['apps']['reports']['subtitle'] = $SubTituloR; 94 94 $pdf->Cell(0,8,$SubTitulo,0,1,'C',0); 95 96 95 97 96 //Set font and colors … … 127 126 $row_loginid = $account['account_lid']; 128 127 $row_cn = $account['account_cn']; 129 $row_mail = (!$account['account_mail'] ? '<font color=red> Sem E-mail</font>' : $account['account_mail']);128 $row_mail = (!$account['account_mail'] ? '<font color=red>'.lang('Without E-mail').'</font>' : $account['account_mail']); 130 129 $row_phone = (!$account['account_phone'] ? '-' : $account['account_phone']); 131 $row_status = $account['account_accountstatus'] == 'active' ? 'Ativado' : 'Desativado';130 $row_status = $account['account_accountstatus'] == 'active' ? lang('Activated') : lang('Disabled'); 132 131 $pdf->Cell(55,5,$row_loginid,0,0,'L',0); 133 132 $pdf->Cell(80,5,$row_cn,0,0,'L',0); 134 133 $pdf->Cell(80,5,$row_mail,0,0,'L',0); 135 134 $pdf->Cell(35,5,$row_phone,0,0,'L',0); 136 if ($row_status == 'Ativado')135 if ($row_status == lang('Activated')) 137 136 { 138 137 //Restaura cor fonte … … 499 498 'row_loginid' => $accountr['account_lid'], 500 499 'row_cn' => $accountr['account_cn'], 501 'row_status' => $accountr['account_status'] == 'active' ? '<font color="#0033FF">Ativado</font> ' : '<font color="#FF0000">Desativado</font>',500 'row_status' => $accountr['account_status'] == 'active' ? '<font color="#0033FF">'.lang('Activated').'</font> ' : '<font color="#FF0000">'.lang('Disabled').'</font>', 502 501 'row_phone' => (!$accountr['account_phone'] ? '-' : $accountr['account_phone']), 503 'row_mail' => (!$accountr['account_mail'] ? '<font color=red>Sem E-mail</font>' : $accountr['account_mail'])502 'row_mail' => (!$accountr['account_mail'] ? '<font color=red>'.lang('Without E-mail').'</font>' : $accountr['account_mail']) 504 503 ); 505 504 -
sandbox/expressoMail1_2/MailArchiver/2.2/reports/inc/class.uireports_usersgroups.inc.php
r4035 r4644 78 78 $pdf->Open(); 79 79 $pdf->AddPage(); 80 $pdf->SetTitle( 'Relatório Gerado pelo Expresso Reports');80 $pdf->SetTitle(lang('Report of institutional accounts of the Organization')); 81 81 82 82 //Set font and colors … … 89 89 //Table header 90 90 $SubTitulo = lang('reports title10'); 91 $SubTituloR = lang(' report organization');91 $SubTituloR = lang('Report Generated by Expresso Reports'); 92 92 $SubTitulo1 = $subtitulo1; 93 93 $GLOBALS['phpgw_info']['apps']['reports']['subtitle'] = $SubTituloR; -
sandbox/expressoMail1_2/MailArchiver/2.2/reports/index.php
r3948 r4644 28 28 'lang_rel_title' => lang('reports'), 29 29 'lang_rel_user_org' => lang('report organization'), 30 'lang_rel_share_account_org' => lang('report share account organization'), 31 'lang_rel_institutional_account_org' => lang('report institutional account organization'), 30 32 'lang_rel_cota_org' => lang('report cota organization'), 31 33 'lang_rel_logon_org' => lang('report of time without logging by Organization'), -
sandbox/expressoMail1_2/MailArchiver/2.2/reports/setup/phpgw_pt-br.lang
r3666 r4644 1 Activated reports pt-br Ativado 2 Date reports pt-br Data 3 Without E-mail reports pt-br Sem E-mail 4 Report of shared accounts of the Organization reports pt-br Relatório das contas compartilhadas da Organização 5 Report shared accounts by Organization reports pt-br Relatório de contas compartilhadas por Organização 6 Report Generated by Expresso Reports reports pt-br Relatório gerado pelo Expresso Reports 7 report institutional account organization reports pt-br Relatório de contas institucionais por Organização 8 Report of institutional accounts of the Organization reports pt-br Relatório de contas institucionais da Organização 9 Report institutional accounts by Organization reports pt-br Relatório de contas institucionais por Organização 1 10 uidNumber reports pt-br UID 2 11 user login reports pt-br Login do usuário … … 27 36 reports reports pt-br Relatórios 28 37 report organization reports pt-br Relatório de usuários por Organização 38 report share account organization reports pt-br Relatório de contas compartilhadas por Organização 29 39 report cota organization reports pt-br Relatório de cotas por Organização 30 40 report maillists organization reports pt-br Relatório de lista de emails por Organização -
sandbox/expressoMail1_2/MailArchiver/2.2/reports/templates/default/index.tpl
r3948 r4644 12 12 </style> 13 13 <table width="90%" border="0" cellspacing="10" cellpadding="0" align="center"> 14 <!-- TODOS OS USUARIOS DO CONTEXTO15 <tr>16 <td width="1%" align="center"><img src='./templates/default/images/user.png'></td>17 <td>18 <a href="../index.php?menuaction=reports.uireports.report_users_print">{lang_rel_user_all}</a>19 </td>20 </tr>21 -->22 14 <tr> 23 15 <td width="1%" align="center"><img src='./templates/default/images/user.png'></td> 24 16 <td> 25 17 <a href="../index.php?menuaction=reports.uireports_users.report_users_group">{lang_rel_user_org}</a> 18 </td> 19 </tr> 20 <tr> 21 <td width="1%" align="center"><img src='./templates/default/images/institutional_account.png'></td> 22 <td> 23 <a href="../index.php?menuaction=reports.uireports_institutionalAccounts.report_institutionalAccounts_group">{lang_rel_institutional_account_org}</a> 24 </td> 25 </tr> 26 <tr> 27 <td width="1%" align="center"><img src='./templates/default/images/mail_share.png'></td> 28 <td> 29 <a href="../index.php?menuaction=reports.uireports_shareAccounts.report_shareAccounts_group">{lang_rel_share_account_org}</a> 26 30 </td> 27 31 </tr> -
sandbox/expressoMail1_2/MailArchiver/2.2/workflow/inc/class.JobScheduler.inc.php
r3184 r4644 73 73 { 74 74 case DateType::ABSOLUTE_DATE: 75 $object = &Factory:: getInstance('AbsoluteDate', $startDate, $interval);75 $object = &Factory::newInstance('AbsoluteDate', $startDate, $interval); 76 76 break; 77 77 78 78 case DateType::WEEK_DATE: 79 $object = &Factory:: getInstance('WeekDate', $startDate, $interval);79 $object = &Factory::newInstance('WeekDate', $startDate, $interval); 80 80 $object->setWeekDays($record['week_days']); 81 81 break; 82 82 83 83 case DateType::RELATIVE_DATE: 84 $object = &Factory:: getInstance('RelativeDate', $startDate, $interval);84 $object = &Factory::newInstance('RelativeDate', $startDate, $interval); 85 85 $object->setOffset($record['month_offset']); 86 86 break;
Note: See TracChangeset
for help on using the changeset viewer.