Changeset 5662


Ignore:
Timestamp:
03/07/12 15:38:42 (12 years ago)
Author:
gustavo
Message:

Ticket #2088 - Melhorias no editor de regras de filtro de mensagens do Expresso

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/modules/filters/filters.js

    r5656 r5662  
    11valid_save = function(){ 
     2        var accord = list_container.find(".rule-details-container").accordion({autoHeight: false}); 
    23        if(list_container.find('[name="name"]').attr("disabled") != "disabled") 
    34        { 
    45                if($.trim(list_container.find('[name="name"]').val()) == ""){ 
    5                         alert("Nenhum nome preenchido"); 
     6                        $.Zebra_Dialog("<strong>Nenhum nome</strong> preenchido",{ 
     7                                'onClose':  function(caption) { 
     8                                        list_container.find('[name="name"]').focus(); 
     9                                } 
     10                        }); 
     11                        accord.accordion('activate',0); 
    612                        return false; 
    713                }else if($.trim(list_container.find('[name="name"]').val()) == "vacation"){ 
    8                         alert("Nome inválido, 'vacation' é uma palavra reservada"); 
     14                        $.Zebra_Dialog("Nome inválido, <strong>'vacation'</strong> é uma palavra reservada",{ 
     15                                'onClose':  function(caption) { 
     16                                        list_container.find('[name="name"]').val("").focus(); 
     17                                } 
     18                        }); 
     19                        accord.accordion('activate',0); 
    920                        return false; 
    1021                }else{ 
     
    1324                        $.each(filter_list, function(index, value){ 
    1425                                if(filter_list[index].name == list_container.find('[name="name"]').val()){ 
    15                                         alert("já existe um filtro com este nome"); 
     26                                        $.Zebra_Dialog("Já existe um filtro com este nome",{ 
     27                                                'onClose':  function(caption) { 
     28                                                        list_container.find('[name="name"]').val("").focus(); 
     29                                                } 
     30                                        }); 
     31                                        accord.accordion('activate',0); 
    1632                                        error = true; 
    1733                                        return; 
     
    2945        }); 
    3046        if(criteria == ""){ 
    31                 alert("Nenhum criterio preenchido"); 
     47                $.Zebra_Dialog("Nenhum <strong>criterio</strong> preenchido",{ 
     48                        'onClose':  function(caption) { 
     49                                list_container.find('[name="criteriaValue[]"]:first').focus(); 
     50                        } 
     51                }); 
     52                accord.accordion('activate',0); 
    3253                return false; 
    3354        } 
    3455        if(list_container.find('[name="actionType[]"]:checked').parent().find("input:text, textarea").length){ 
    3556                if($.trim(list_container.find('[name="actionType[]"]:checked').parent().find("input:text, textarea").val()) == ""){ 
    36                         alert("Preencha o valor da ação"); 
     57                        $.Zebra_Dialog("Preencha o valor da <strong>ação</strong>",{ 
     58                                'onClose':  function(caption) { 
     59                                        list_container.find('[name="actionType[]"]:checked').parent().find("input:text, textarea").focus(); 
     60                                } 
     61                        }); 
    3762                        return false; 
    3863                } 
     
    657682                                DataLayer.remove( 'filter', filters[index].id ); 
    658683                                DataLayer.commit("filter"); 
    659                                 alert("Bloqueio do usuario " + email + " removido!"); 
     684                                $.Zebra_Dialog("Bloqueio do usuario " + email + " removido!"); 
    660685                                return true; 
    661                         } else return true; 
     686                        }else 
     687                                return true; 
    662688                } 
    663689        } 
     
    674700         
    675701        DataLayer.commit("filter"); 
    676         alert("Usuário " + email + " bloqueado!"); 
     702        $.Zebra_Dialog("Usuário " + email + " bloqueado!"); 
    677703} 
    678704 
     
    782808                                        else 
    783809                                                return; 
    784                                         DataLayer.commit( 'filter' ); 
    785                                         DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 
     810                                        DataLayer.commit( 'filter', false,function(){ 
     811                                                DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 
     812                                        }); 
    786813                                }); 
    787814                        }else{ 
     
    792819                                }).end().filter(".submit").click(function(){ 
    793820                                        $(this).submit(); 
    794                                         DataLayer.commit( 'filter' ); 
    795                                         DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 
     821                                        DataLayer.commit( 'filter', false,function(){ 
     822                                                DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 
     823                                        }); 
    796824                                }); 
    797825                                details_container.find('[name="vacation"]').val(filters.actions[0].parameter); 
     
    831859                text: false 
    832860        }).click(function(event){ 
    833                 $(event.target) 
    834                 .parents("li.rule").find('.id') 
    835                 .each( function(){ 
    836                         DataLayer.remove( 'filter', $(this).val() ); 
    837                 }); 
    838                 DataLayer.commit("filter", false,function(){ 
    839                         DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 
     861                var filter_name = $(event.target).parents("li.rule").find('.id').val(); 
     862                $.Zebra_Dialog("Deseja realmente excluir o filtro : <strong>"+filter_name+"</strong>",{ 
     863                        'type':     'question', 
     864                        'title':    'Confirmação de Exclusão', 
     865                        'buttons':  [get_lang('Yes'), get_lang('No')], 
     866                        'onClose':  function(caption) { 
     867                                if(caption == get_lang('Yes')){ 
     868                                        DataLayer.remove( 'filter', filter_name); 
     869                                        DataLayer.commit("filter", false,function(){ 
     870                                                DataLayer.render( BASE_PATH + 'modules/filters/init.ejs', {},list_filters); 
     871                                        }); 
     872                                }else{ 
     873                                        $(event.target).removeClass("ui-selected").parent().removeClass("ui-selected"); 
     874                                } 
     875                        } 
    840876                }); 
    841877        }).end().removeClass("ui-button-icon-only"); 
Note: See TracChangeset for help on using the changeset viewer.