Ignore:
Timestamp:
08/09/12 18:31:49 (12 years ago)
Author:
acoutinho
Message:

Ticket #2966 - Correcao de bugs e refactoring das novas funcionalidades

Location:
sandbox/2.4.2-expresso1/prototype/modules/calendar
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.4.2-expresso1/prototype/modules/calendar/css/layout.css

    r6946 r6981  
    786786 
    787787.button.add.button-add-attachment{margin: -9px 0 0 8px;} 
     788.button.btn-success.fileinput-button{width: 85px;} 
    788789.button.btn-danger.delete{margin: 0 0 0 0; min-width: 143px;} 
    789790 
  • sandbox/2.4.2-expresso1/prototype/modules/calendar/js/activity.helpers.js

    r6977 r6981  
    363363                        }); 
    364364                }); 
    365                 $('.attachment-list input').remove(); 
    366                 $('.row.fileupload-buttonbar-activity .attachments-list p').remove(); 
     365                $('div.new-activity-win .attachment-list input').remove(); 
     366                $('div.new-activity-win .row.fileupload-buttonbar-activity .attachments-list p').remove(); 
     367                $('div.new-activity-win .btn-danger.delete').addClass('hidden'); 
    367368            } 
    368369        }}); 
     
    383384    text: false 
    384385}); 
    385 var maxSizeFile = 2000000; 
    386 $('#fileuploadactivity').fileupload({ 
    387     sequentialUploads: true, 
    388     add: function (e, data) { 
    389         if(data.files[0].size < maxSizeFile) 
    390             data.submit(); 
    391     }, 
    392     change: function (e, data) { 
    393         $.each(data.files, function (index, file) { 
    394             var attach = {}; 
    395             attach.fileName = file.name; 
    396             var ext = file.name.split('.'); 
    397             if(file.name.length > 10) 
    398                 attach.fileName = ext.length == 1 ? file.name.substr(0, 10) :  file.name.substr(0, 6) + '.' + ext[ext.length -1]; 
    399             attach.fileSize = formatBytes(file.size); 
    400             if(file.size > maxSizeFile) 
    401                 attach.error = 'Tamanho de arquivo nao permitido!!' 
    402                                  
    403             $('div.new-activity-win .attachments-list').append(DataLayer.render(path+'templates/attachment_add_itemlist.ejs', { 
    404                 file : attach 
    405             })); 
    406                                  
    407             if(file.size < maxSizeFile){ 
    408                 $('div.new-activity-win .fileinput-button.new').append(data.fileInput[0]).removeClass('new'); 
    409                 $('div.new-activity-win .attachments-list').find('[type=file]').addClass('hidden'); 
    410                                          
    411             }else 
    412                 $('div.new-activity-win .fileinput-button.new').removeClass('new'); 
    413                                  
    414                                  
    415             $('div.new-activity-win .attachments-list').find('.button.close').button({ 
    416                 icons: { 
    417                     primary: "ui-icon-close" 
    418                 }, 
    419                 text: false 
    420             }).click(function(){ 
    421                 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
    422                 $('.attachment-list').find('input[value="'+idAttach+'"]') 
    423                 $(this).parent().remove(); 
    424             });  
    425                                  
    426         }) 
    427         }, 
    428     done: function(e, data){ 
    429         var currentUpload = $('div.new-activity-win .progress.after-upload:first').removeClass('after-upload').addClass('on-complete').hide(); 
    430  
    431         if(!!data.result && data.result != "[]"){ 
    432             var newAttach = (attch = jQuery.parseJSON(data.result)) ? attch : jQuery.parseJSON(data.result[0].activeElement.childNodes[0].data); 
    433             $('div.new-activity-win .attachment-list').append('<input tyepe="hidden" name="attachment[]" value="'+newAttach['attachment'][0][0].id+'"/>'); 
    434             currentUpload.removeClass('on-complete').parents('p') 
    435             .append('<input type="hidden" name="fileId[]" value="'+newAttach['attachment'][0][0].id+'"/>') 
    436             .find('.status-upload').addClass('ui-icon ui-icon-check'); 
    437         }else 
    438             currentUpload.removeClass('on-complete').parents('p').find('.status-upload').addClass('ui-icon ui-icon-cancel'); 
    439         } 
    440 }); 
    441 $('.attachments-list .button').button(); 
    442  
    443 if(!!window.FormData)                    
    444 $('#fileuploadactivity').bind('fileuploadstart', function () { 
    445     var widget = $(this), 
    446     progressElement = $('#fileupload-progress-activity').fadeIn(), 
    447     interval = 500, 
    448     total = 0, 
    449     loaded = 0, 
    450     loadedBefore = 0, 
    451     progressTimer, 
    452     progressHandler = function (e, data) { 
    453         loaded = data.loaded; 
    454         total = data.total; 
    455     }, 
    456     stopHandler = function () { 
    457         widget 
    458         .unbind('fileuploadprogressall', progressHandler) 
    459         .unbind('fileuploadstop', stopHandler); 
    460         window.clearInterval(progressTimer); 
    461         progressElement.fadeOut(function () { 
    462             progressElement.html(''); 
    463         }); 
    464     }, 
    465     formatTime = function (seconds) { 
    466         var date = new Date(seconds * 1000); 
    467         return ('0' + date.getUTCHours()).slice(-2) + ':' + 
    468         ('0' + date.getUTCMinutes()).slice(-2) + ':' + 
    469         ('0' + date.getUTCSeconds()).slice(-2); 
    470     }, 
    471     /* formatBytes = function (bytes) { 
    472             if (bytes >= 1000000000) { 
    473                 return (bytes / 1000000000).toFixed(2) + ' GB'; 
    474             } 
    475             if (bytes >= 1000000) { 
    476                 return (bytes / 1000000).toFixed(2) + ' MB'; 
    477             } 
    478             if (bytes >= 1000) { 
    479                 return (bytes / 1000).toFixed(2) + ' KB'; 
    480             } 
    481             return bytes + ' B'; 
    482         },*/ 
    483     formatPercentage = function (floatValue) { 
    484         return (floatValue * 100).toFixed(2) + ' %'; 
    485     }, 
    486     updateProgressElement = function (loaded, total, bps) { 
    487         progressElement.html( 
    488             formatBytes(bps) + 'ps | ' + 
    489             formatTime((total - loaded) / bps) + ' | ' + 
    490             formatPercentage(loaded / total) + ' | ' + 
    491             formatBytes(loaded) + ' / ' + formatBytes(total) 
    492             ); 
    493     }, 
    494     intervalHandler = function () { 
    495         var diff = loaded - loadedBefore; 
    496         if (!diff) { 
    497             return; 
    498         } 
    499         loadedBefore = loaded; 
    500         updateProgressElement( 
    501             loaded, 
    502             total, 
    503             diff * (1000 / interval) 
    504             ); 
    505     }; 
    506     widget 
    507     .bind('fileuploadprogressall', progressHandler) 
    508     .bind('fileuploadstop', stopHandler); 
    509     progressTimer = window.setInterval(intervalHandler, interval); 
    510 }); 
     386 
     387extendsFileupload('activity', path); 
    511388 
    512389UI.dialogs.addActivity.find(':input').change(function(event){ 
  • sandbox/2.4.2-expresso1/prototype/modules/calendar/js/helpers.js

    r6976 r6981  
    164164        $('.fc-header-right').append(print); 
    165165        $('.fc-button-print').click(function(){ 
    166                 alert('A tela de impressão será melhor visualizada com a preferência "Paisagem" do seu browser selecionada.'); 
    167                 printNow(); 
     166            alert('A tela de impressão será melhor visualizada com a preferência "Paisagem" do seu browser selecionada.'); 
     167            printNow(); 
    168168        }); 
    169169} 
     
    14531453                        }); 
    14541454                }); 
    1455                 $('.attachment-list input').remove(); 
    1456                 $('.row.fileupload-buttonbar .attachments-list p').remove(); 
     1455                $('div.new-event-win .attachment-list input').remove(); 
     1456                $('div.new-event-win .row.fileupload-buttonbar .attachments-list p').remove(); 
     1457                $('div.new-event-win .btn-danger.delete').addClass('hidden'); 
    14571458            } 
    14581459        }}); 
     
    14731474    text: false 
    14741475}); 
    1475 var maxSizeFile = 2000000; 
    1476 $('#fileuploadevent').fileupload({ 
    1477     sequentialUploads: true, 
    1478     add: function (e, data) { 
    1479         if(data.files[0].size < maxSizeFile) 
    1480             data.submit(); 
    1481     }, 
    1482     change: function (e, data) { 
    1483         $.each(data.files, function (index, file) { 
    1484             var attach = {}; 
    1485             attach.fileName = file.name; 
    1486             var ext = file.name.split('.'); 
    1487             if(file.name.length > 10) 
    1488                 attach.fileName = ext.length == 1 ? file.name.substr(0, 10) :  file.name.substr(0, 6) + '.' + ext[ext.length -1]; 
    1489             attach.fileSize = formatBytes(file.size); 
    1490             if(file.size > maxSizeFile) 
    1491                 attach.error = 'Tamanho de arquivo nao permitido!!' 
    1492                                  
    1493             $('div.new-event-win .attachments-list').append(DataLayer.render(path+'templates/attachment_add_itemlist.ejs', { 
    1494                 file : attach 
    1495             })); 
    1496                                  
    1497             if(file.size < maxSizeFile){ 
    1498                 $('div.new-event-win .fileinput-button.new').append(data.fileInput[0]).removeClass('new'); 
    1499                 $('div.new-event-win .attachments-list').find('[type=file]').addClass('hidden'); 
    1500                                          
    1501             }else 
    1502                 $('div.new-event-win .fileinput-button.new').removeClass('new'); 
    1503                                  
    1504                                  
    1505             $('div.new-event-win .attachments-list').find('.button.close').button({ 
    1506                 icons: { 
    1507                     primary: "ui-icon-close" 
    1508                 }, 
    1509                 text: false 
    1510             }).click(function(){ 
    1511                 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
    1512                 $('div.new-event-win .attachment-list').find('input[value="'+idAttach+'"]') 
    1513                 $(this).parent().remove(); 
    1514             });  
    1515                                  
    1516         }) 
    1517         }, 
    1518     done: function(e, data){ 
    1519         var currentUpload = $('div.new-event-win .progress.after-upload:first').removeClass('after-upload').addClass('on-complete').hide(); 
    1520  
    1521         if(!!data.result && data.result != "[]"){ 
    1522             var newAttach = (attch = jQuery.parseJSON(data.result)) ? attch : jQuery.parseJSON(data.result[0].activeElement.childNodes[0].data); 
    1523             $('div.new-event-win .attachment-list').append('<input tyepe="hidden" name="attachment[]" value="'+newAttach['attachment'][0][0].id+'"/>'); 
    1524             currentUpload.removeClass('on-complete').parents('p') 
    1525             .append('<input type="hidden" name="fileId[]" value="'+newAttach['attachment'][0][0].id+'"/>') 
    1526             .find('.status-upload').addClass('ui-icon ui-icon-check'); 
    1527         }else 
    1528             currentUpload.removeClass('on-complete').parents('p').find('.status-upload').addClass('ui-icon ui-icon-cancel'); 
    1529     } 
    1530 }); 
    1531 $('.attachments-list .button').button(); 
    1532  
    1533 if(!!window.FormData)                    
    1534 $('#fileuploadevent').bind('fileuploadstart', function () { 
    1535     var widget = $(this), 
    1536     progressElement = $('#fileupload-progress-event').fadeIn(), 
    1537     interval = 500, 
    1538     total = 0, 
    1539     loaded = 0, 
    1540     loadedBefore = 0, 
    1541     progressTimer, 
    1542     progressHandler = function (e, data) { 
    1543         loaded = data.loaded; 
    1544         total = data.total; 
    1545     }, 
    1546     stopHandler = function () { 
    1547         widget 
    1548         .unbind('fileuploadprogressall', progressHandler) 
    1549         .unbind('fileuploadstop', stopHandler); 
    1550         window.clearInterval(progressTimer); 
    1551         progressElement.fadeOut(function () { 
    1552             progressElement.html(''); 
    1553         }); 
    1554     }, 
    1555     formatTime = function (seconds) { 
    1556         var date = new Date(seconds * 1000); 
    1557         return ('0' + date.getUTCHours()).slice(-2) + ':' + 
    1558         ('0' + date.getUTCMinutes()).slice(-2) + ':' + 
    1559         ('0' + date.getUTCSeconds()).slice(-2); 
    1560     }, 
    1561     /* formatBytes = function (bytes) { 
    1562             if (bytes >= 1000000000) { 
    1563                 return (bytes / 1000000000).toFixed(2) + ' GB'; 
    1564             } 
    1565             if (bytes >= 1000000) { 
    1566                 return (bytes / 1000000).toFixed(2) + ' MB'; 
    1567             } 
    1568             if (bytes >= 1000) { 
    1569                 return (bytes / 1000).toFixed(2) + ' KB'; 
    1570             } 
    1571             return bytes + ' B'; 
    1572         },*/ 
    1573     formatPercentage = function (floatValue) { 
    1574         return (floatValue * 100).toFixed(2) + ' %'; 
    1575     }, 
    1576     updateProgressElement = function (loaded, total, bps) { 
    1577         progressElement.html( 
    1578             formatBytes(bps) + 'ps | ' + 
    1579             formatTime((total - loaded) / bps) + ' | ' + 
    1580             formatPercentage(loaded / total) + ' | ' + 
    1581             formatBytes(loaded) + ' / ' + formatBytes(total) 
    1582             ); 
    1583     }, 
    1584     intervalHandler = function () { 
    1585         var diff = loaded - loadedBefore; 
    1586         if (!diff) { 
    1587             return; 
    1588         } 
    1589         loadedBefore = loaded; 
    1590         updateProgressElement( 
    1591             loaded, 
    1592             total, 
    1593             diff * (1000 / interval) 
    1594             ); 
    1595     }; 
    1596     widget 
    1597     .bind('fileuploadprogressall', progressHandler) 
    1598     .bind('fileuploadstop', stopHandler); 
    1599     progressTimer = window.setInterval(intervalHandler, interval); 
    1600 }); 
     1476 
     1477extendsFileupload('event', path); 
    16011478         
    16021479if(objEvent.isShared){ 
     
    25732450        case 'basicDay': 
    25742451        case 'agendaDay': 
    2575             rangeStart = new Date().add({ 
     2452            rangeStart = new Date.today().add({ 
    25762453                days: page_index 
    25772454            }).getTime(); 
    2578             rangeEnd = rangeStart; 
     2455            rangeEnd = rangeStart + 86400000; 
    25792456            break; 
    25802457        case 'agendaWeek': 
     
    29822859    } 
    29832860} 
     2861 
     2862function extendsFileupload(view, path){ 
     2863    var viewName = 'div.new-'+view+'-win'; 
     2864     
     2865    path = !!path ? path : ''; 
     2866     
     2867    var maxSizeFile = 2000000; 
     2868    $('#fileupload'+view).fileupload({ 
     2869        sequentialUploads: true, 
     2870        add: function (e, data) { 
     2871            if(data.files[0].size < maxSizeFile) 
     2872                data.submit(); 
     2873        }, 
     2874        change: function (e, data) { 
     2875            $.each(data.files, function (index, file) { 
     2876                var attach = {}; 
     2877                attach.fileName = file.name; 
     2878                var ext = file.name.split('.'); 
     2879                if(file.name.length > 10) 
     2880                    attach.fileName = ext.length == 1 ? file.name.substr(0, 10) :  file.name.substr(0, 6) + '.' + ext[ext.length -1]; 
     2881                attach.fileSize = formatBytes(file.size); 
     2882                if(file.size > maxSizeFile) 
     2883                    attach.error = 'Tamanho de arquivo nao permitido!!' 
     2884                                 
     2885                $(viewName+' .attachments-list').append(DataLayer.render(path+'templates/attachment_add_itemlist.ejs', { 
     2886                    file : attach 
     2887                })); 
     2888                                 
     2889                if(file.size < maxSizeFile){ 
     2890                    $(viewName+' .fileinput-button.new').append(data.fileInput[0]).removeClass('new'); 
     2891                    $(viewName+' .attachments-list').find('[type=file]').addClass('hidden'); 
     2892                                         
     2893                }else 
     2894                    $(viewName+' .fileinput-button.new').removeClass('new'); 
     2895                                 
     2896                                 
     2897                $(viewName+' .attachments-list').find('.button.close').button({ 
     2898                    icons: { 
     2899                        primary: "ui-icon-close" 
     2900                    }, 
     2901                    text: false 
     2902                }).click(function(){ 
     2903                    var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
     2904                    $(viewName+' .attachment-list').find('input[value="'+idAttach+'"]').remove(); 
     2905                    $(this).parent().remove(); 
     2906                 
     2907                    if(!$(viewName+' .attachment-list input').length) 
     2908                        $(viewName+' .btn-danger.delete').addClass('hidden'); 
     2909                 
     2910                });      
     2911                                 
     2912            }) 
     2913        }, 
     2914        done: function(e, data){ 
     2915            var currentUpload = $(viewName+' .progress.after-upload:first').removeClass('after-upload').addClass('on-complete').hide(); 
     2916 
     2917            if(!!data.result && data.result != "[]"){ 
     2918                $(viewName+' .btn-danger.delete').removeClass('hidden'); 
     2919                var newAttach = (attch = jQuery.parseJSON(data.result)) ? attch : jQuery.parseJSON(data.result[0].activeElement.childNodes[0].data); 
     2920                $(viewName+' .attachment-list').append('<input tyepe="hidden" name="attachment[]" value="'+newAttach['attachment'][0][0].id+'"/>'); 
     2921                currentUpload.removeClass('on-complete').parents('p') 
     2922                .append('<input type="hidden" name="fileId[]" value="'+newAttach['attachment'][0][0].id+'"/>') 
     2923                .find('.status-upload').addClass('ui-icon ui-icon-check'); 
     2924            }else 
     2925                currentUpload.removeClass('on-complete').parents('p').find('.status-upload').addClass('ui-icon ui-icon-cancel'); 
     2926        } 
     2927    }); 
     2928    $('.attachments-list .button').button();     
     2929 
     2930    if(!!window.FormData)                        
     2931        $('#fileupload'+view).bind('fileuploadstart', function () { 
     2932            var widget = $(this), 
     2933            progressElement = $('#fileupload-progress-'+view).fadeIn(), 
     2934            interval = 500, 
     2935            total = 0, 
     2936            loaded = 0, 
     2937            loadedBefore = 0, 
     2938            progressTimer, 
     2939            progressHandler = function (e, data) { 
     2940                loaded = data.loaded; 
     2941                total = data.total; 
     2942            }, 
     2943            stopHandler = function () { 
     2944                widget 
     2945                .unbind('fileuploadprogressall', progressHandler) 
     2946                .unbind('fileuploadstop', stopHandler); 
     2947                window.clearInterval(progressTimer); 
     2948                progressElement.fadeOut(function () { 
     2949                    progressElement.html(''); 
     2950                }); 
     2951            }, 
     2952            formatTime = function (seconds) { 
     2953                var date = new Date(seconds * 1000); 
     2954                return ('0' + date.getUTCHours()).slice(-2) + ':' + 
     2955                ('0' + date.getUTCMinutes()).slice(-2) + ':' + 
     2956                ('0' + date.getUTCSeconds()).slice(-2); 
     2957            }, 
     2958            /* formatBytes = function (bytes) { 
     2959            if (bytes >= 1000000000) { 
     2960                return (bytes / 1000000000).toFixed(2) + ' GB'; 
     2961            } 
     2962            if (bytes >= 1000000) { 
     2963                return (bytes / 1000000).toFixed(2) + ' MB'; 
     2964            } 
     2965            if (bytes >= 1000) { 
     2966                return (bytes / 1000).toFixed(2) + ' KB'; 
     2967            } 
     2968            return bytes + ' B'; 
     2969        },*/ 
     2970            formatPercentage = function (floatValue) { 
     2971                return (floatValue * 100).toFixed(2) + ' %'; 
     2972            }, 
     2973            updateProgressElement = function (loaded, total, bps) { 
     2974                progressElement.html( 
     2975                    formatBytes(bps) + 'ps | ' + 
     2976                    formatTime((total - loaded) / bps) + ' | ' + 
     2977                    formatPercentage(loaded / total) + ' | ' + 
     2978                    formatBytes(loaded) + ' / ' + formatBytes(total) 
     2979                    ); 
     2980            }, 
     2981            intervalHandler = function () { 
     2982                var diff = loaded - loadedBefore; 
     2983                if (!diff) { 
     2984                    return; 
     2985                } 
     2986                loadedBefore = loaded; 
     2987                updateProgressElement( 
     2988                    loaded, 
     2989                    total, 
     2990                    diff * (1000 / interval) 
     2991                    ); 
     2992            }; 
     2993            widget 
     2994            .bind('fileuploadprogressall', progressHandler) 
     2995            .bind('fileuploadstop', stopHandler); 
     2996            progressTimer = window.setInterval(intervalHandler, interval); 
     2997        }); 
     2998     
     2999} 
  • sandbox/2.4.2-expresso1/prototype/modules/calendar/js/task.helpers.js

    r6977 r6981  
    666666                        }); 
    667667                    }); 
    668                     $('.attachment-list input').remove(); 
    669                     $('.row.fileupload-buttonbar .attachments-list p').remove(); 
     668                    $('div.new-task-win .attachment-list input').remove(); 
     669                    $('div.new-task-win .row.fileupload-buttonbar .attachments-list p').remove(); 
     670                    $('div.new-task-win .btn-danger.delete').addClass('hidden'); 
    670671                } 
    671672            } 
     
    685686        text: false 
    686687    }); 
    687     var maxSizeFile = 2000000; 
    688     $('#fileuploadtask').fileupload({ 
    689         sequentialUploads: true, 
    690         add: function (e, data) { 
    691             if (data.files[0].size < maxSizeFile) data.submit(); 
    692         }, 
    693         change: function (e, data) { 
    694             $.each(data.files, function (index, file) { 
    695                 var attach = {}; 
    696                 attach.fileName = file.name; 
    697                 var ext = file.name.split('.'); 
    698                 if (file.name.length > 10) attach.fileName = ext.length == 1 ? file.name.substr(0, 10) : file.name.substr(0, 6) + '.' + ext[ext.length - 1]; 
    699                 attach.fileSize = formatBytes(file.size); 
    700                 if (file.size > maxSizeFile) attach.error = 'Tamanho de arquivo nao permitido!!' 
    701  
    702                 $('div.new-task-win .attachments-list').append(DataLayer.render(path + 'templates/attachment_add_itemlist.ejs', { 
    703                     file: attach 
    704                 })); 
    705  
    706                 if (file.size < maxSizeFile) { 
    707                     $('div.new-task-win .fileinput-button.new').append(data.fileInput[0]).removeClass('new'); 
    708                     $('div.new-task-win .attachments-list').find('[type=file]').addClass('hidden'); 
    709  
    710                 } else $('div.new-task-win .fileinput-button.new').removeClass('new'); 
    711  
    712  
    713                 $('div.new-task-win .attachments-list').find('.button.close').button({ 
    714                     icons: { 
    715                         primary: "ui-icon-close" 
    716                     }, 
    717                     text: false 
    718                 }).click(function () { 
    719                     var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 
    720                     $('div.new-task-win .attachment-list').find('input[value="' + idAttach + '"]') 
    721                     $(this).parent().remove(); 
    722                 }); 
    723  
    724             }) 
    725         }, 
    726         done: function (e, data) { 
    727             var currentUpload = $('div.new-task-win .progress.after-upload:first').removeClass('after-upload').addClass('on-complete').hide(); 
    728  
    729             if ( !! data.result && data.result != "[]") { 
    730                 var newAttach = (attch = jQuery.parseJSON(data.result)) ? attch : jQuery.parseJSON(data.result[0].activeElement.childNodes[0].data); 
    731                 $('div.new-task-win .attachment-list').append('<input tyepe="hidden" name="attachment[]" value="' + newAttach['attachment'][0][0].id + '"/>'); 
    732                 currentUpload.removeClass('on-complete').parents('p').append('<input type="hidden" name="fileId[]" value="' + newAttach['attachment'][0][0].id + '"/>').find('.status-upload').addClass('ui-icon ui-icon-check'); 
    733             } else currentUpload.removeClass('on-complete').parents('p').find('.status-upload').addClass('ui-icon ui-icon-cancel'); 
    734         } 
    735     }); 
    736     $('div.new-task-win .attachments-list .button').button(); 
    737  
    738     if ( !! window.FormData) $('#fileuploadtask').bind('fileuploadstart', function () { 
    739         var widget = $(this), 
    740             progressElement = $('#fileupload-progress-task').fadeIn(), 
    741             interval = 500, 
    742             total = 0, 
    743             loaded = 0, 
    744             loadedBefore = 0, 
    745             progressTimer, progressHandler = function (e, data) { 
    746                 loaded = data.loaded; 
    747                 total = data.total; 
    748             }, 
    749             stopHandler = function () { 
    750                 widget.unbind('fileuploadprogressall', progressHandler).unbind('fileuploadstop', stopHandler); 
    751                 window.clearInterval(progressTimer); 
    752                 progressElement.fadeOut(function () { 
    753                     progressElement.html(''); 
    754                 }); 
    755             }, 
    756             formatTime = function (seconds) { 
    757                 var date = new Date(seconds * 1000); 
    758                 return ('0' + date.getUTCHours()).slice(-2) + ':' + ('0' + date.getUTCMinutes()).slice(-2) + ':' + ('0' + date.getUTCSeconds()).slice(-2); 
    759             }, 
    760  
    761             formatPercentage = function (floatValue) { 
    762                 return (floatValue * 100).toFixed(2) + ' %'; 
    763             }, 
    764             updateProgressElement = function (loaded, total, bps) { 
    765                 progressElement.html( 
    766                 formatBytes(bps) + 'ps | ' + formatTime((total - loaded) / bps) + ' | ' + formatPercentage(loaded / total) + ' | ' + formatBytes(loaded) + ' / ' + formatBytes(total)); 
    767             }, 
    768             intervalHandler = function () { 
    769                 var diff = loaded - loadedBefore; 
    770                 if (!diff) { 
    771                     return; 
    772                 } 
    773                 loadedBefore = loaded; 
    774                 updateProgressElement( 
    775                 loaded, total, diff * (1000 / interval)); 
    776             }; 
    777         widget.bind('fileuploadprogressall', progressHandler).bind('fileuploadstop', stopHandler); 
    778         progressTimer = window.setInterval(intervalHandler, interval); 
    779     }); 
     688 
     689    extendsFileupload('task', path); 
    780690 
    781691    disponibily(objTask, path, attendees, 'task'); 
  • sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/activity_add.ejs

    r6974 r6981  
    197197                                <%if(data.activity && data.activity.attachments){ 
    198198                                for (var i=0; i< data.activity.attachments.length; i++) {%> 
    199                                 <input type="hidden" name="fileId[]" value="<%=data.activity.attachments[i].id%>"/> 
     199                                    <input type="hidden" name="fileId[]" value="<%=data.activity.attachments[i].id%>"/> 
    200200                                <%} 
    201201                                }%> 
     
    216216                                                </span> 
    217217 
    218                                                 <button type="button" class="button btn-danger delete"> 
     218                                                <button type="button" class="button btn-danger delete <%= data.activity && data.activity.attachments && data.activity.attachments.length ? '' : 'hidden' %>"> 
    219219                                                    <i class="icon-trash icon-white"></i> Remover Todos 
    220220                                                </button> 
  • sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/event_add.ejs

    r6974 r6981  
    183183                                <%}%> 
    184184                                <%if(data.event.acl.organization || data.event.acl.write){%> 
    185                                         <button type="button" class="button btn-danger delete"> 
     185                                        <button type="button" class="button btn-danger delete <%= data.event && data.event.attachments && data.event.attachments.length ? '' : 'hidden' %>"> 
    186186                                                <i class="icon-trash icon-white"></i> Remover Todos 
    187187                                        </button> 
  • sandbox/2.4.2-expresso1/prototype/modules/calendar/templates/task_add.ejs

    r6974 r6981  
    212212                    <input type="file" name="files[]" multiple> 
    213213                </span> 
    214                                 <button type="button" class="button btn-danger delete"> 
    215                                         <i class="icon-trash icon-white"></i> Remover Todos 
    216                                 </button> 
     214                <button type="button" class="button btn-danger delete <%= data.task && data.task.attachments && data.task.attachments.length ? '' : 'hidden' %>"> 
     215                        <i class="icon-trash icon-white"></i> Remover Todos 
     216                </button> 
    217217            </div> 
    218218            <div id="fileupload-progress-task"></div> 
Note: See TracChangeset for help on using the changeset viewer.