Ignore:
Timestamp:
03/22/11 18:15:51 (13 years ago)
Author:
alexandrecorreia
Message:

Ticket #1580 - Mensagem de erro pouco amigável para arquivos grandes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/filemanager/js/common_functions.js

    r3879 r3888  
    2929{ 
    3030        element.firstChild.firstChild.checked = true; 
     31} 
     32 
     33function maxFileSize() 
     34{ 
     35        if( arguments.length > 0 ) 
     36        { 
     37                var _document           = arguments[0]; 
     38                var _maxFileSize                = ""; 
     39                 
     40                for(var i = 0 ;  i < _document.forms[0].elements.length ; i++ ) 
     41                { 
     42                        if( _document.forms[0].elements[i].type == "text" ) 
     43                        {        
     44                                var _name = (_document.forms[0].elements[i].name).toLowerCase(); 
     45                                 
     46                                if( _name.indexOf('filemanager_max_file_size') > - 1 ) 
     47                                        _maxFileSize = trim(_document.forms[0].elements[i].value); 
     48                        } 
     49                } 
     50                 
     51                var handlerSubmit = function(data) 
     52                { 
     53                        _document.forms[0].submit.click(); 
     54                } 
     55                 
     56                if( _maxFileSize != '' ) 
     57                { 
     58                        cExecute_( './index.php?menuaction=filemanager.uifilemanager.setFileMaxSize', handlerSubmit,'maxFileSize=' + _maxFileSize ); 
     59                } 
     60                else 
     61                { 
     62                        alert('É necessário informar um valor !'); 
     63                        return false; 
     64                } 
     65        } 
     66} 
     67 
     68function trim(inputString) 
     69{ 
     70        if ( typeof inputString != "string" ) 
     71                return inputString; 
     72 
     73        var retValue    = inputString; 
     74        var ch          = retValue.substring(0, 1); 
     75         
     76        while (ch == " ")  
     77        { 
     78                retValue = retValue.substring(1, retValue.length); 
     79                ch = retValue.substring(0, 1); 
     80        } 
     81         
     82        ch = retValue.substring(retValue.length-1, retValue.length); 
     83         
     84        while (ch == " ")  
     85        { 
     86                retValue = retValue.substring(0, retValue.length-1); 
     87                ch = retValue.substring(retValue.length-1, retValue.length); 
     88        } 
     89         
     90        while (retValue.indexOf("  ") != -1)  
     91        { 
     92                retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
     93        } 
     94         
     95        return retValue; 
    3196} 
    3297 
Note: See TracChangeset for help on using the changeset viewer.