[6092] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
| 2 | <HTML> |
---|
| 3 | <HEAD> |
---|
| 4 | <script type="text/javascript" src="./libs/jquery.js"></script> |
---|
[6312] | 5 | <script type="text/javascript" src="./libs/jquery.json-2.3.min.js"></script> |
---|
[6092] | 6 | <script type="text/javascript" src="./libs/jsonreport.js"></script> |
---|
| 7 | <script type="text/javascript" src="./libs/Base64.js"></script> |
---|
| 8 | <TITLE>..:: Página de Teste - REST API ::..</TITLE> |
---|
| 9 | <META http-equiv="Content-Type" content="text/html; charset=utf-8"> |
---|
| 10 | <style type="text/css"> |
---|
| 11 | * { |
---|
| 12 | font-family: sans-serif, verdana, arial; |
---|
| 13 | font-size: 12px; |
---|
| 14 | } |
---|
| 15 | table { |
---|
| 16 | background:#ECECEC; |
---|
| 17 | padding:5px; |
---|
| 18 | border:1px solid black |
---|
| 19 | } |
---|
| 20 | |
---|
| 21 | .loader |
---|
| 22 | { |
---|
| 23 | position:absolute; |
---|
| 24 | padding: 5px; |
---|
| 25 | right:10px; |
---|
| 26 | top:10px; |
---|
| 27 | color: black; |
---|
| 28 | text-align:center; |
---|
| 29 | border: solid 1px black; |
---|
| 30 | z-index: 200; |
---|
| 31 | } |
---|
| 32 | </style> |
---|
| 33 | </HEAD> |
---|
| 34 | <BODY> |
---|
| 35 | <DIV style="display:none" class="loader" id="loader"> |
---|
| 36 | <label id="loader_msg"></label><br> |
---|
| 37 | <img src="./images/loader.gif"/> |
---|
| 38 | </DIV> |
---|
| 39 | <TABLE> |
---|
| 40 | <TR><TD><b>Servidor</b></TD> |
---|
| 41 | <TD><select id="server"><option value="">Selecionar ....</option></select> |
---|
| 42 | <input id="bt_servers" type="button" value="Listar Servidores" onclick="javascript:jExecute('AvailableServers')"/> |
---|
| 43 | <input id="bt_version" type="button" value="Versão API" onclick="javascript:jExecute('ExpressoVersion')"/> |
---|
| 44 | <input id="bt_version" type="button" value="Teste Erro" onclick="javascript:jExecute('Teste')"/> |
---|
| 45 | </TD> |
---|
| 46 | </TR> |
---|
[6311] | 47 | <TR><TD><b>Login</b></TD> |
---|
| 48 | <TD> |
---|
| 49 | <input type="text" id="user"/> |
---|
| 50 | <input id="bt_myPicture" type="button" value="Visualizar Foto" onclick="javascript:jExecute('GetMyPicture')"/> |
---|
| 51 | </TD> |
---|
| 52 | </TR> |
---|
[6092] | 53 | <TR><TD><b>Senha</b></TD><TD><input type="password" id="password"/> |
---|
| 54 | <input id="bt_login" type="button" value="Conectar" onclick="javascript:jExecute('Login')"/> |
---|
| 55 | <input id="bt_logout" type="button" value="Desconectar" onclick="javascript:jExecute('Logout')"/> |
---|
| 56 | </TD></TR> |
---|
| 57 | </TABLE> |
---|
| 58 | <BR><BR> |
---|
| 59 | <TABLE> |
---|
| 60 | <TR><TD><b>Esvaziar Lixeira</b></TD> |
---|
| 61 | <TD><input id="bt_esvaziar_lixeira" type="button" value="Esvaziar Lixeira" onclick="javascript:jExecute('CleanTrash')"/></TD> |
---|
| 62 | </TR> |
---|
| 63 | <TR><TD><b>Suporte/Sugestão</b></TD> |
---|
| 64 | <TD><textarea id="text_message">Texto do e-mail de suporte/sugestao!!</textarea></TD> |
---|
| 65 | <TD><input id="bt_sugestao" type="button" value="Enviar Sugestão" onclick="javascript:jExecute('SendSupportFeedback')"/></TD> |
---|
| 66 | </TR> |
---|
| 67 | </TABLE><br><br> |
---|
| 68 | <TABLE> |
---|
| 69 | <TR><TD><b>Pastas IMAP</b></TD> |
---|
[6156] | 70 | <TD><input type="text" id="search_folders"/><input id="bt_listFolders" type="button" value="Pesquisar" onclick="javascript:jExecute('Mail/Folders')"/></TD> |
---|
| 71 | <TD colspan=2><select id="folder_id" onchange="javascript:jExecute('Mail/Messages')"><option value="INBOX">Selecionar pasta</option></select> |
---|
[6092] | 72 | <select id="message_id" onchange="javascript:jExecute('getMessage')"><option value="-1">Selecionar mensagem</option></select> |
---|
[6312] | 73 | <select id="attachment_id" onchange="javascript:jExecute('getAttachment')"><option value="-1">Selecionar Anexo</option></select> |
---|
[6092] | 74 | </TD> |
---|
| 75 | </TR> |
---|
[6156] | 76 | <TR><TD></TD><TD></TD> |
---|
| 77 | <TD colspan=2><input id="bt_del_folder" type="button" value="Apagar Pasta" onclick="javascript:jExecute('DelFolder')"/></TD> |
---|
| 78 | </TR> |
---|
| 79 | <TR><TD></TD><TD></TD> |
---|
| 80 | <TD><input type="text" id="new_folder_name"/></TD> |
---|
| 81 | <TD> |
---|
| 82 | <input id="bt_add_folder" type="button" value="Adicionar Pasta" onclick="javascript:jExecute('AddFolder')"/><br> |
---|
| 83 | <input id="bt_rename_folder" type="button" value="Renomear Pasta" onclick="javascript:jExecute('RenameFolder')"/> |
---|
| 84 | </TD> |
---|
| 85 | </TR> |
---|
[6092] | 86 | <TR><TD><b>Contatos</b></TD> |
---|
[6156] | 87 | <TD colspan=3><input type="text" id="search_contacts"/><input id="bt_contacts" type="button" value="Pesquisar" onclick="javascript:jExecute('getContacts')"/> |
---|
[6092] | 88 | <select id="sel_contacts" onchange="javascript:jExecute('getContactPicture')"><option value="-1">Selecionar contato</option></select> |
---|
| 89 | |
---|
| 90 | </TD> |
---|
| 91 | </TR> |
---|
| 92 | <TR><TD><b>Catalogo</b></TD> |
---|
[6156] | 93 | <TD colspan=3> |
---|
[6092] | 94 | <input type="text" id="search_catalog"/><input id="bt_catalog" type="button" value="Pesquisar" onclick="javascript:jExecute('getCatalog')"/> |
---|
| 95 | <select id="sel_catalog" onchange="javascript:jExecute('getCatalogPicture')"><option value="-1">Selecionar contato</option></select> |
---|
| 96 | </TD> |
---|
| 97 | </TR> |
---|
| 98 | </TABLE> |
---|
| 99 | <BR><BR> |
---|
| 100 | <TABLE> |
---|
| 101 | <TR><TD><b>Resposta JSON-RPC</b> |
---|
| 102 | <input id="bt_clear" type="button" value="Limpar Saída" onclick="javascript:clearOut()"/> |
---|
| 103 | </TD></TR> |
---|
| 104 | <TR><TD style="background:#FFF !important;padding:0px;"> |
---|
| 105 | <img id="img_photo" style="display:none;"/> |
---|
| 106 | <div id="message" class="jsonreport"></div> |
---|
| 107 | </TD></TR> |
---|
| 108 | </TABLE> |
---|
| 109 | </BODY> |
---|
| 110 | <script language="Javascript"> |
---|
| 111 | |
---|
| 112 | function clearOut(){ |
---|
| 113 | $('#message').html(""); |
---|
| 114 | $('#img_photo').hide(); |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | function dispatch(_action, response, _search){ |
---|
| 118 | var a_response = jQuery.parseJSON(response); |
---|
| 119 | if(a_response){ |
---|
| 120 | |
---|
| 121 | if(a_response.result && a_response.result.auth) { |
---|
| 122 | setCookie ("auth", a_response.result.auth); |
---|
| 123 | setCookie ("server", $('#server').val()); |
---|
| 124 | $('#user').attr("disabled", true); |
---|
| 125 | $('#password').attr("disabled", true); |
---|
| 126 | $('#server').attr("disabled", true); |
---|
| 127 | |
---|
| 128 | $('#bt_servers').attr("disabled", true); |
---|
| 129 | $('#bt_login').attr("disabled", true); |
---|
| 130 | $('#bt_logout').attr("disabled", false); |
---|
| 131 | $('#bt_listFolders').attr("disabled", false); |
---|
| 132 | $('#bt_contacts').attr("disabled", false); |
---|
| 133 | $('#bt_catalog').attr("disabled", false); |
---|
| 134 | $('#sel_contacts').attr("disabled", false); |
---|
| 135 | $('#sel_catalog').attr("disabled", false); |
---|
| 136 | $('#search_contacts').attr("disabled", false); |
---|
| 137 | $('#search_catalog').attr("disabled", false); |
---|
| 138 | $('#search_folders').attr("disabled", false); |
---|
| 139 | |
---|
| 140 | } |
---|
| 141 | else if(_action == 'Logout' || (a_response.error && a_response.error.code == 7 )) { |
---|
| 142 | $('#user').attr("disabled", false); |
---|
| 143 | $('#password').attr("disabled", false); |
---|
| 144 | $('#server').attr("disabled", false); |
---|
| 145 | |
---|
| 146 | $('#bt_servers').attr("disabled", false); |
---|
| 147 | $('#bt_login').attr("disabled", false); |
---|
| 148 | $('#bt_logout').attr("disabled", true); |
---|
| 149 | $('#bt_contacts').attr("disabled", true); |
---|
| 150 | $('#bt_catalog').attr("disabled", true); |
---|
| 151 | $('#bt_listFolders').attr("disabled", true); |
---|
[6156] | 152 | $('#bt_del_folder').attr("disabled", true); |
---|
| 153 | $('#bt_add_folder').attr("disabled", true); |
---|
| 154 | $('#bt_rename_folder').attr("disabled", true); |
---|
[6092] | 155 | |
---|
| 156 | $('#folder_id').attr("disabled", true); |
---|
| 157 | $('#message_id').attr("disabled", true); |
---|
[6312] | 158 | $('#attachment_id').attr("disabled", true); |
---|
[6092] | 159 | $('#sel_contacts').attr("disabled", true); |
---|
| 160 | $('#sel_catalog').attr("disabled", true); |
---|
| 161 | $('#search_contacts').attr("disabled", true); |
---|
| 162 | $('#search_catalog').attr("disabled", true); |
---|
| 163 | $('#search_folders').attr("disabled", true); |
---|
[6156] | 164 | $('#new_folder_name').attr("disabled", true); |
---|
[6092] | 165 | |
---|
| 166 | clearOut(); |
---|
| 167 | setCookie ("auth", ''); |
---|
| 168 | setCookie ("server", ''); |
---|
| 169 | } |
---|
| 170 | } |
---|
| 171 | $('#message').append("<BR>"); |
---|
| 172 | if(a_response.error){ |
---|
| 173 | clearOut(); |
---|
| 174 | $('#message').append("<font color='red'>[erro "+a_response.error.code+"] "+a_response.error.message+"</font>"); |
---|
| 175 | return; |
---|
| 176 | } |
---|
| 177 | if(a_response.result){ |
---|
| 178 | if(typeof(a_response.result) != 'object') { |
---|
| 179 | $('#message').append("<font color='green'>"+a_response.result+"</font>"); |
---|
| 180 | return; |
---|
| 181 | } |
---|
| 182 | if(a_response.result.folders) { |
---|
| 183 | $("#folder_id").find('option').remove().end().append("<option value='-1'>Selecionar Pasta</option>"); |
---|
| 184 | for (var j in a_response.result.folders){ |
---|
| 185 | $("#folder_id").append("<option value='"+a_response.result.folders[j].folderID+"'>"+ |
---|
| 186 | a_response.result.folders[j].folderName+"</option>"); |
---|
| 187 | } |
---|
| 188 | $('#folder_id').attr("disabled", false); |
---|
[6156] | 189 | $('#new_folder_name').attr("disabled", false); |
---|
| 190 | $('#bt_del_folder').attr("disabled", false); |
---|
| 191 | $('#bt_add_folder').attr("disabled", false); |
---|
| 192 | $('#bt_rename_folder').attr("disabled", false); |
---|
[6092] | 193 | } |
---|
[6312] | 194 | if(a_response.result.messages) { |
---|
| 195 | $('#message_id').attr("disabled", false); |
---|
| 196 | if(a_response.result.messages.length == 1) { |
---|
| 197 | $("#attachment_id").find('option').remove().end().append("<option value='-1'>Selecionar Anexo</option>"); |
---|
| 198 | if(a_response.result.messages[0].msgHasAttachments > 0) { |
---|
| 199 | $('#attachment_id').attr("disabled", false); |
---|
| 200 | var attachments = a_response.result.messages[0].msgAttachments; |
---|
| 201 | for (var j in attachments){ |
---|
| 202 | $("#attachment_id").append("<option value='"+attachments[j].pid+"'>"+attachments[j].name+"</option>"); |
---|
| 203 | } |
---|
| 204 | } |
---|
| 205 | else{ |
---|
| 206 | $('#attachment_id').attr("disabled", true); |
---|
| 207 | } |
---|
| 208 | } |
---|
| 209 | else{ |
---|
| 210 | $("#message_id").find('option').remove().end().append("<option value='-1'>Selecionar Mensagem</option>"); |
---|
| 211 | for (var j in a_response.result.messages){ |
---|
| 212 | var value = a_response.result.messages[j].msgSubject.length > 20 ? |
---|
| 213 | a_response.result.messages[j].msgSubject.substring(0, 20) : a_response.result.messages[j].msgSubject; |
---|
[6092] | 214 | |
---|
[6312] | 215 | a_response.result.messages[j].msgBodyResume = (a_response.result.messages[j].msgBodyResume); |
---|
| 216 | $("#message_id").append("<option value='"+a_response.result.messages[j].msgID+"'>"+ |
---|
| 217 | value+"</option>"); |
---|
| 218 | } |
---|
[6092] | 219 | } |
---|
| 220 | } |
---|
| 221 | |
---|
| 222 | var select_id = (_search == '#search_contacts' ? '#sel_contacts' : (_search == '#search_catalog' ? '#sel_catalog' : '')); |
---|
| 223 | if(select_id) |
---|
| 224 | $(select_id).find('option').remove().end().append("<option value='-1'>Selecionar Contato</option>"); |
---|
| 225 | |
---|
| 226 | if(a_response.result.contacts && a_response.result.contacts.length > 0) { |
---|
| 227 | for (var j in a_response.result.contacts){ |
---|
| 228 | var value = (a_response.result.contacts[j].contactFullName != null ? a_response.result.contacts[j].contactFullName : "Vazio (ID "+a_response.result.contacts[j].contactID+")"); |
---|
| 229 | if(select_id){ |
---|
| 230 | $(select_id).append("<option value='"+a_response.result.contacts[j].contactID+"'>"+ |
---|
| 231 | value+"</option>"); |
---|
| 232 | } |
---|
| 233 | } |
---|
| 234 | if(a_response.result.contacts && a_response.result.contacts.length == 1) { |
---|
| 235 | if(a_response.result.contacts[0].contactImagePicture){ |
---|
| 236 | base64Data = a_response.result.contacts[0].contactImagePicture; |
---|
| 237 | $('#img_photo').attr("src", "data:image/jpg;base64,"+ base64Data); |
---|
| 238 | $('#img_photo').show(); |
---|
| 239 | return; |
---|
| 240 | } |
---|
| 241 | else{ |
---|
| 242 | $('#img_photo').hide(); |
---|
| 243 | } |
---|
| 244 | } |
---|
| 245 | if(select_id){ |
---|
| 246 | $(select_id).attr("disabled", false); |
---|
| 247 | } |
---|
| 248 | } |
---|
| 249 | |
---|
| 250 | if(a_response.result.servers) { |
---|
| 251 | $("#server").find('option').remove().end().append("<option value=''>Selecionar Servidor</option>"); |
---|
| 252 | for (var j in a_response.result.servers){ |
---|
| 253 | $("#server").append("<option value='"+(a_response.result.servers[j].serverUrl+a_response.result.servers[j].serverContext)+"'>"+ |
---|
| 254 | a_response.result.servers[j].serverName+"</option>"); |
---|
| 255 | } |
---|
| 256 | $('#bt_version').attr("disabled", false); |
---|
| 257 | $('#bt_clear').attr("disabled", false); |
---|
| 258 | } |
---|
| 259 | |
---|
| 260 | var html = _.jsonreport(a_response.result); |
---|
| 261 | |
---|
| 262 | $('#message').html(html); |
---|
| 263 | } |
---|
| 264 | } |
---|
| 265 | |
---|
| 266 | function jExecute(_action){ |
---|
| 267 | var _server = getCookie('server') ? getCookie('server') : ($('#server').val() ? $('#server').val() : null); |
---|
| 268 | var _contactType; |
---|
| 269 | var _contactID; |
---|
| 270 | var _search; |
---|
| 271 | var _message; |
---|
| 272 | var _method = "POST"; |
---|
| 273 | |
---|
| 274 | if(_server == null && _action != 'AvailableServers'){ |
---|
| 275 | alert("Nenhum servidor foi definido."); |
---|
| 276 | return; |
---|
| 277 | } |
---|
| 278 | |
---|
| 279 | |
---|
[6312] | 280 | if(_action == "getAttachment"){ |
---|
| 281 | downloadAttachment(); |
---|
| 282 | return; |
---|
| 283 | } |
---|
| 284 | |
---|
[6092] | 285 | switch(_action){ |
---|
| 286 | case 'Mail/Folders': |
---|
| 287 | _search = '#search_folders'; |
---|
| 288 | break; |
---|
[6156] | 289 | case 'AddFolder': |
---|
| 290 | _action = 'Mail/AddFolder'; |
---|
| 291 | break; |
---|
| 292 | case 'DelFolder': |
---|
| 293 | _action = 'Mail/DelFolder'; |
---|
| 294 | break; |
---|
| 295 | case 'RenameFolder': |
---|
| 296 | _action = 'Mail/RenameFolder'; |
---|
| 297 | break; |
---|
[6092] | 298 | case 'getMessages': |
---|
| 299 | _action = 'Mail/Messages'; |
---|
| 300 | $("#message_id").find('option').remove().end().append("<option value='-1'>Selecionar Mensagem</option>"); |
---|
| 301 | break; |
---|
| 302 | case 'getMessage': |
---|
| 303 | _action = 'Mail/Messages'; |
---|
| 304 | break; |
---|
| 305 | case 'CleanTrash': |
---|
| 306 | _action = 'Mail/CleanTrash'; |
---|
| 307 | break; |
---|
| 308 | case 'SendSupportFeedback': |
---|
| 309 | _action = 'Mail/SendSupportFeedback'; |
---|
| 310 | _message = $('#text_message').val(); |
---|
| 311 | break; |
---|
| 312 | case 'getContacts': |
---|
| 313 | _action = 'Catalog/Contacts'; |
---|
| 314 | _search = '#search_contacts'; |
---|
| 315 | _contactType = '1'; |
---|
| 316 | $("#sel_contacts").find('option').remove().end().append("<option value='-1'>Selecionar Contato</option>"); |
---|
| 317 | break; |
---|
| 318 | case 'getCatalog': |
---|
| 319 | _action = 'Catalog/Contacts'; |
---|
| 320 | _search = '#search_catalog'; |
---|
| 321 | _contactType = '2'; |
---|
| 322 | $("#sel_catalog").find('option').remove().end().append("<option value='-1'>Selecionar Contato</option>"); |
---|
| 323 | break; |
---|
| 324 | case 'getContactPicture': |
---|
| 325 | _action = 'Catalog/ContactPicture'; |
---|
| 326 | _contactID = '#sel_contacts'; |
---|
| 327 | _contactType = '1'; |
---|
| 328 | break; |
---|
| 329 | case 'getCatalogPicture': |
---|
| 330 | _action = 'Catalog/ContactPicture'; |
---|
| 331 | _contactID = '#sel_catalog'; |
---|
| 332 | _contactType = '2'; |
---|
| 333 | break; |
---|
[6311] | 334 | case 'GetMyPicture': |
---|
| 335 | _action = 'Catalog/ContactPicture'; |
---|
| 336 | _contactType = '2'; |
---|
| 337 | break; |
---|
[6092] | 338 | |
---|
| 339 | } |
---|
| 340 | |
---|
| 341 | $.ajax({ |
---|
| 342 | type: "POST", |
---|
| 343 | url: "restclient.php", |
---|
| 344 | data: {params: { |
---|
| 345 | user: $('#user').val(), |
---|
| 346 | password: $('#password').val(), |
---|
| 347 | server: _server, |
---|
| 348 | auth: getCookie('auth') != null ? getCookie('auth') : "", |
---|
| 349 | folderID: $('#folder_id').val(), |
---|
| 350 | msgID: $('#message_id').val(), |
---|
[6311] | 351 | contactID: (_contactID ? $(_contactID).val() : ""), |
---|
[6092] | 352 | message: _message, |
---|
| 353 | contactType: _contactType, |
---|
[6156] | 354 | search: $(_search).val(), |
---|
| 355 | newFolderName: $('#new_folder_name').val(), |
---|
[6092] | 356 | method: _method |
---|
| 357 | }, |
---|
| 358 | action: _action |
---|
| 359 | }, |
---|
| 360 | beforeSend: function() { |
---|
| 361 | clearOut(); |
---|
| 362 | $('#loader_msg').html("Aguarde, solicitando informações ..."); |
---|
| 363 | $('#loader').show(); |
---|
| 364 | } |
---|
| 365 | , |
---|
| 366 | success: function(response) { |
---|
| 367 | dispatch(_action, response, _search); |
---|
| 368 | $('#loader').hide(); |
---|
| 369 | } |
---|
| 370 | , |
---|
| 371 | error: function(response) { |
---|
| 372 | alert("Serviço indisponÃvel"); |
---|
| 373 | $('#loader').hide(); |
---|
| 374 | } |
---|
| 375 | |
---|
| 376 | }); |
---|
| 377 | |
---|
| 378 | } |
---|
| 379 | |
---|
[6312] | 380 | function downloadAttachment(){ |
---|
| 381 | var _server = getCookie('server') ? getCookie('server') : ($('#server').val() ? $('#server').val() : null); |
---|
| 382 | var form = document.createElement("form"); |
---|
| 383 | $(form).attr({"action":_server+"Mail/Attachment","method":"POST"}); |
---|
| 384 | |
---|
| 385 | var _params = { |
---|
| 386 | auth: getCookie('auth') != null ? getCookie('auth') : "", |
---|
| 387 | folderID: $('#folder_id').val(), |
---|
| 388 | msgID: $('#message_id').val(), |
---|
| 389 | attachmentID: $('#attachment_id').val() |
---|
| 390 | }; |
---|
| 391 | |
---|
| 392 | $(form).append($(document.createElement('input')).attr( {"name":"params", "value": $.toJSON(_params)})); |
---|
[6315] | 393 | var secretThing = $('<iframe id="IFrameToDownload" style="display:none"></iframe>'); |
---|
[6312] | 394 | $('body').append(secretThing); |
---|
| 395 | $("#IFrameToDownload").contents().find('body').append(form); |
---|
| 396 | $(form).submit(); |
---|
| 397 | } |
---|
| 398 | |
---|
[6092] | 399 | function getCookie(c_name) |
---|
| 400 | { |
---|
| 401 | var i,x,y,ARRcookies=document.cookie.split(";"); |
---|
| 402 | for (i=0;i<ARRcookies.length;i++) |
---|
| 403 | { |
---|
| 404 | x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); |
---|
| 405 | y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); |
---|
| 406 | x=x.replace(/^\s+|\s+$/g,""); |
---|
| 407 | if (x==c_name) |
---|
| 408 | { |
---|
| 409 | if(y == "") |
---|
| 410 | return null; |
---|
| 411 | else |
---|
| 412 | return unescape(y); |
---|
| 413 | } |
---|
| 414 | } |
---|
| 415 | } |
---|
| 416 | |
---|
| 417 | function setCookie(c_name,value,exdays) |
---|
| 418 | { |
---|
| 419 | var exdate=new Date(); |
---|
| 420 | exdate.setDate(exdate.getDate() + exdays); |
---|
| 421 | var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); |
---|
| 422 | document.cookie=c_name + "=" + c_value; |
---|
| 423 | } |
---|
| 424 | // Reset values |
---|
| 425 | var isLoggedIn = false; |
---|
| 426 | if(getCookie('auth') != null && getCookie('server') != null){ |
---|
| 427 | isLoggedIn = true; |
---|
| 428 | } |
---|
| 429 | |
---|
| 430 | $('#user').attr("disabled", isLoggedIn ? true : false); |
---|
| 431 | $('#password').attr("disabled", isLoggedIn ? true : false); |
---|
| 432 | $('#server').attr("disabled", isLoggedIn ? true : false); |
---|
| 433 | $('#bt_servers').attr("disabled", isLoggedIn ? true : false); |
---|
| 434 | $('#bt_login').attr("disabled", isLoggedIn ? true : false); |
---|
| 435 | $('#bt_logout').attr("disabled", isLoggedIn ? false : true); |
---|
| 436 | $('#bt_listFolders').attr("disabled", isLoggedIn ? false : true); |
---|
[6312] | 437 | $('#folder_id').attr("disabled", true); |
---|
| 438 | $('#message_id').attr("disabled", true); |
---|
| 439 | $('#attachment_id').attr("disabled", true); |
---|
| 440 | $('#contact_id').attr("disabled",true); |
---|
| 441 | $('#sel_contacts').attr("disabled", true); |
---|
| 442 | $('#sel_catalog').attr("disabled", true); |
---|
[6092] | 443 | $('#search_contacts').attr("disabled", isLoggedIn ? false : true); |
---|
| 444 | $('#search_catalog').attr("disabled", isLoggedIn ? false : true); |
---|
| 445 | $('#search_folders').attr("disabled", isLoggedIn ? false : true); |
---|
[6156] | 446 | $('#new_folder_name').attr("disabled", isLoggedIn ? false : true); |
---|
[6092] | 447 | $('#bt_contacts').attr("disabled", isLoggedIn ? false : true); |
---|
| 448 | $('#bt_catalog').attr("disabled", isLoggedIn ? false : true); |
---|
[6156] | 449 | $('#bt_del_folder').attr("disabled", isLoggedIn ? false : true); |
---|
| 450 | $('#bt_add_folder').attr("disabled", isLoggedIn ? false : true); |
---|
| 451 | $('#bt_rename_folder').attr("disabled", isLoggedIn ? false : true); |
---|
[6092] | 452 | $('#bt_version').attr("disabled", false); |
---|
| 453 | $('#bt_clear').attr("disabled", false); |
---|
| 454 | </script> |
---|
| 455 | </html> |
---|