Changeset 7661


Ignore:
Timestamp:
12/17/12 14:46:45 (11 years ago)
Author:
acoutinho
Message:

Ticket #3239 - Inconsistencia na importacao de eventos com repeticao

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/modules/calendar/js/helpers.js

    r7602 r7661  
    27192719            sequentialUploads: true, 
    27202720            add: function (e, data) { 
    2721                 form = data 
    2722                 var name = form.files[0].name; 
    2723                 $('.import-event-form').find('input[type="file"]').hide(); 
    2724                 $('.import-event-form').find('span.file-add').removeClass('hidden'); 
    2725                 $('.import-event-form').find('span.file-add').append('<span>'+ name +'</span><a class="button remove-attachment tiny"></a>'); 
    2726                 $('.import-event-form').find('.button.remove-attachment').button({ 
    2727                     icons: { 
    2728                         primary: "ui-icon-close" 
    2729                     }, 
    2730                     text: false 
    2731                 }).click(function (event){ 
    2732                     $('.import-event-form').find('input[type="file"]').show(); 
    2733                     $('.import-event-form').find('span.file-add').addClass('hidden').html(''); 
    2734                     form = false; 
    2735                 }); 
    2736                                  
    2737                                  
     2721            form = data 
     2722            var name = form.files[0].name; 
     2723            $('.import-event-form').find('input[type="file"]').hide(); 
     2724            $('.import-event-form').find('span.file-add').removeClass('hidden'); 
     2725            $('.import-event-form').find('span.file-add').append('<span>'+ name +'</span><a class="button remove-attachment tiny"></a>'); 
     2726            $('.import-event-form').find('.button.remove-attachment').button({ 
     2727                icons: { 
     2728                primary: "ui-icon-close" 
     2729                }, 
     2730                text: false 
     2731            }).click(function (event){ 
     2732                $('.import-event-form').find('input[type="file"]').show(); 
     2733                $('.import-event-form').find('span.file-add').addClass('hidden').html(''); 
     2734                form = false; 
     2735            }); 
     2736 
    27382737            }, 
     2738        submit:function(e, data){ 
     2739 
     2740            $('div.import-export').find('a.button').button('option', 'disabled', true) 
     2741            $('.import-event-form').find('span.file-add').append('<img src="../prototype/modules/calendar/img/ajax-loader.gif">'); 
     2742 
     2743        }, 
    27392744            done: function(e, data){ 
    2740                 var msg = ''; 
    2741                 var type = ''; 
    2742  
    2743         if(!!data.result && data.result == '[][""]' || data.result.indexOf('Error') >= 0 ){ 
    2744             msg = 'Erro ao realizar a importação, por favor verifique o arquivo .ics'; 
    2745             type = 'warning'; 
    2746  
    2747                 }else{ 
    2748  
    2749             if(data.result.indexOf('schedulable') >= 0){ 
    2750                 msg = 'Importação realizada com sucesso!'; 
    2751                 type = 'confirmation'; 
    2752                 Calendar.rerenderView(true); 
     2745            var msg = ''; 
     2746            var type = ''; 
     2747 
     2748            if(!!data.result && data.result == '[][""]' || data.result.indexOf('Error') >= 0 ){ 
     2749                msg = 'Erro ao realizar a importação, por favor verifique o arquivo .ics'; 
     2750                type = 'warning'; 
     2751 
     2752                $('div.import-export').find('a.button').button('option', 'disabled', false) 
     2753                $('.import-event-form').find('span.file-add img ').remove(); 
     2754 
    27532755            }else{ 
    2754                 var res = JSON.parse(data.result); 
    2755                 var asData = false; 
    2756  
    2757                 for(var i = 0; i < res.length; i++) 
    2758                     if(res[i].length > 0) 
    2759                         asData = true; 
    2760  
    2761                 if(asData){ 
     2756 
     2757                if(data.result.indexOf('schedulable') >= 0){ 
    27622758                    msg = 'Importação realizada com sucesso!'; 
    27632759                    type = 'confirmation'; 
    27642760                    Calendar.rerenderView(true); 
    27652761                }else{ 
    2766                     msg = 'Não foram encontrados novos eventos na importação!'; 
    2767                     type = 'information'; 
     2762                    var res = JSON.parse(data.result); 
     2763                    var asData = false; 
     2764 
     2765                    for(var i = 0; i < res.length; i++) 
     2766                        if(res[i].length > 0) 
     2767                            asData = true; 
     2768 
     2769                    if(asData){ 
     2770                        msg = 'Importação realizada com sucesso!'; 
     2771                        type = 'confirmation'; 
     2772                        Calendar.rerenderView(true); 
     2773                    }else{ 
     2774                        msg = 'Não foram encontrados novos eventos na importação!'; 
     2775                        type = 'information'; 
     2776                    } 
    27682777                } 
     2778 
     2779                UI.dialogs.importCalendar.dialog("close"); 
    27692780            } 
    2770         } 
    2771  
    2772                 $.Zebra_Dialog(msg, { 
    2773                     'type':     type, 
    2774                     'overlay_opacity': '0.5', 
    2775                     'buttons':  ['Fechar'] 
    2776                 }); 
     2781 
     2782            $.Zebra_Dialog(msg, { 
     2783                'type':     type, 
     2784                'overlay_opacity': '0.5', 
     2785                'buttons':  ['Fechar'] 
     2786            }); 
    27772787            } 
    27782788        }); 
    27792789 
    27802790        UI.dialogs.importCalendar.find(".menu-import-event")         
    2781         .children(".import").click(function(data){ 
    2782             $('.import-event-form fieldset.import-calendar', UI.dialogs.importCalendar).append( 
    2783                 '<input type="hidden" name="params[calendar_timezone]" value="'+   
    2784                 Calendar.signatureOf[$('.import-event-form option:selected').val()].calendar.timezone 
    2785                 +'"/>') 
    2786             if(form) 
    2787                 form.submit();                   
    2788             UI.dialogs.importCalendar.dialog("close"); 
    2789         /** 
    2790                          * TODO - implementar ação de importação 
    2791                          */ 
     2791            .children(".import").click(function(data){ 
     2792            $('.import-event-form fieldset.import-calendar', UI.dialogs.importCalendar).append( 
     2793                '<input type="hidden" name="params[calendar_timezone]" value="'+ 
     2794                Calendar.signatureOf[$('.import-event-form option:selected').val()].calendar.timezone 
     2795                +'"/>') 
     2796            if(form) 
     2797                form.submit(); 
    27922798        }); 
    27932799             
Note: See TracChangeset for help on using the changeset viewer.