Changeset 320 for trunk/expressoMail1_2/js/common_functions.js
- Timestamp:
- 06/18/08 11:28:42 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/common_functions.js
r271 r320 16 16 17 17 window.onresize = resizeWindow; 18 19 function config_events(pObj, pEvent, pHandler) 20 { 21 if( typeof pObj == 'object') 22 { 23 if( pEvent.substring(0, 2) == 'on') 24 pEvent = pEvent.substring(2, pEvent.length); 25 26 if ( pObj.addEventListener ) 27 pObj.addEventListener(pEvent, pHandler, false); 28 else if( pObj.attachEvent ) 29 pObj.attachEvent('on' + pEvent, pHandler ); 30 } 31 } 18 32 19 33 function resizeWindow(){ … … 38 52 } 39 53 Element('content_folders').style.height = defaultHeight - (is_ie ? 165 : 150); 40 if(Element("divScrollMain "))41 Element("divScrollMain ").style.height = defaultHeight - (is_ie ? 111 : 110);54 if(Element("divScrollMain_"+numBox)) 55 Element("divScrollMain_"+numBox).style.height = defaultHeight - (is_ie ? 111 : 110); 42 56 } 43 57 // END: FUNCTION RESIZE WINDOW 44 58 45 59 // onUnload edit message 46 if(!is_ie) 60 61 var _beforeunload_ = window.onbeforeunload; 62 63 window.onbeforeunload = function() 47 64 { 48 var beforeunload = window.onbeforeunload; 49 window.onbeforeunload = function() 50 { 51 if ( typeof beforeunload == 'function' ) 52 beforeunload(); 53 54 return unloadMess(); 55 }; 56 } 65 return unloadMess(); 66 } 67 57 68 function unloadMess(){ 58 69 var mess = get_lang("Your message has not been sent and will be discarted."); … … 64 75 } 65 76 } 77 66 78 // Translate words and phrases using user language from eGroupware. 67 79 function get_lang(_key,_arg1,_arg2,_arg3,_arg4) { … … 143 155 if (box != null) 144 156 box.parentNode.removeChild(box); 157 else 158 return false; 145 159 } 146 160 … … 189 203 function addFile(id_border){ 190 204 divFiles = document.getElementById("divFiles_"+id_border); 205 if (! divFiles) 206 return false; 191 207 192 208 if (divFiles.lastChild) … … 216 232 linkFile.id = "linkFile_"+id_border+"_"+countDivFiles; 217 233 linkFile.href='javascript:void(0)'; 218 linkFile.onclick=function () {removeFile(this.id.replace("link","div")); };234 linkFile.onclick=function () {removeFile(this.id.replace("link","div")); return false;}; 219 235 linkFile.innerHTML=get_lang("Remove"); 220 236 //divFile.innerHTML += " "; … … 231 247 232 248 function validateFileExtension(fileName, id, id_border){ 249 233 250 var error_flag = false; 234 if (fileName[0] != '/'){ // file name is windows format? 235 var file = fileName.substr(fileName.lastIndexOf('\\') + 1, fileName.length); 236 if ((fileName.indexOf(':\\') != 1) && (fileName.indexOf('\\\\') != 0)) // Is stored in partition or a network file? 237 error_flag = true; 238 } 239 else // is nix 240 var file = fileName.substr(fileName.lastIndexOf('/') + 1, fileName.length); 251 252 if ( fileName.indexOf('/') != -1 ) 253 { 254 if (fileName[0] != '/'){ // file name is windows format? 255 var file = fileName.substr(fileName.lastIndexOf('\\') + 1, fileName.length); 256 if ((fileName.indexOf(':\\') != 1) && (fileName.indexOf('\\\\') != 0)) // Is stored in partition or a network file? 257 error_flag = true; 258 } 259 else // is Unix 260 var file = fileName.substr(fileName.lastIndexOf('/') + 1, fileName.length); 261 } 262 else // is Firefox 3 263 var file = fileName; 241 264 242 265 var fileExtension = file.split("."); … … 252 275 } 253 276 254 if (error_flag == true){ 277 if ( error_flag == true ) 278 { 255 279 alert(get_lang('File extension forbidden or invalid file') + '.'); 256 280 removeFile(id); … … 259 283 } 260 284 return true; 261 262 285 } 263 286 … … 635 658 function remove_className(obj, className){ 636 659 var re = new RegExp("\\s*"+className); 637 obj.className = obj.className.replace(re, ''); 660 if (obj) 661 obj.className = obj.className.replace(re, ''); 638 662 } 639 663
Note: See TracChangeset
for help on using the changeset viewer.