Changeset 5909


Ignore:
Timestamp:
04/10/12 17:58:11 (12 years ago)
Author:
marcieli
Message:

Ticket #2593 - Concluída melhoria: não permitir marcadores com mesmo nome.

Location:
trunk/prototype/modules/mail
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/modules/mail/interceptors/Helpers.php

    r5893 r5909  
    307307                $Labels = Controller::find(array('concept' => 'label'), false, array('filter' => array('i=', 'name', $nameLabel) )); 
    308308                if($Labels){ 
    309                         //Throw new Exception('Marcador existe'); 
    310                         //$params['id'] = 'Marcador existe'; 
    311                         return false; 
     309                        Throw new Exception('Já existe um marcador com esse nome.'); 
    312310                } 
    313311        } 
  • trunk/prototype/modules/mail/js/label.js

    r5899 r5909  
    115115                        DataLayer.commit(false, false, function(data){ 
    116116                                var hasLabel = true; 
    117                                         for(var i in data){ 
    118                                                 if(parseInt(data[i].id)) 
    119                                                         hasLabel = false; 
     117                                $.each(data, function(index, value) { 
     118                                        if(typeof value == 'object'){ 
     119                                                hasLabel = false; 
    120120                                        } 
     121                                        else { 
     122                                                hasLabel = value; 
     123                                        } 
     124                                }); 
     125                                         
     126                                if(typeof data[0] == 'object'){ 
     127                                        hasLabel = false; 
     128                                } 
    121129                                        if(!hasLabel){ 
    122130                                                $(".label-list-container .label-list li").each(function(){ 
     
    162170                                                loadMenu(); 
    163171                                        }else{ 
    164                                                 alert('Problema ao salvar marcador.'); 
     172                                                alert(hasLabel); 
    165173                                        } 
    166174                                         
     
    244252         
    245253        DataLayer.commit(false, false, function(data){ 
    246         var hasLabel = true; 
    247                 for(var i in data){ 
    248                         if(parseInt(data[i].id)) 
     254                var hasLabel = true; 
     255                $.each(data, function(index, value) { 
     256                        if(typeof value == 'object'){ 
    249257                                hasLabel = false; 
    250                 } 
     258                        }else{ 
     259                                hasLabel = value; 
     260                        } 
     261                }); 
    251262                if(!hasLabel){ 
    252263                        labels = DataLayer.get('label',{criteria:{order: 'id'}}, true); 
     
    303314                        $(".add-label-button").empty() 
    304315                        .addClass("ui-icon ui-icon-plus"); 
    305                         alert('Problema ao salvar marcador.'); 
     316                        alert(hasLabel); 
    306317                } 
    307318        }); 
Note: See TracChangeset for help on using the changeset viewer.