Changeset 7775
- Timestamp:
- 01/21/13 14:54:17 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/main.js
r7771 r7775 40 40 function updateDynamicContact(userContacts){ 41 41 42 if(!userContacts) 43 userContacts = REST.get("/usercontacts", false); 42 if(!userContacts){ 43 userContacts = REST.get("/usercontacts", false, updateDynamicContact); 44 return true; 45 } 46 44 47 45 48 if(userContacts.collection && !userContacts.collection.error){ … … 3155 3158 */ 3156 3159 delete_border(ID,'true'); 3157 var arrayTo = content.find(".to-tr").find(".box").clone(); 3158 save_dynamic_contacts(arrayTo);3159 var arrayCC = content.find(".cc-tr").find(".box").clone();3160 save_dynamic_contacts(arrayCC);3161 var arrayCCo = content.find(".cco-tr").find(".box").clone();3162 save_dynamic_contacts(arrayCCo);3163 if(parseInt(preferences.use_dynamic_contacts))3160 if(parseInt(preferences.use_dynamic_contacts)){ 3161 var arrayTo = content.find(".to-tr").find(".box").clone(); 3162 save_dynamic_contacts(arrayTo); 3163 var arrayCC = content.find(".cc-tr").find(".box").clone(); 3164 save_dynamic_contacts(arrayCC); 3165 var arrayCCo = content.find(".cco-tr").find(".box").clone(); 3166 save_dynamic_contacts(arrayCCo); 3164 3167 updateDynamicContact(); 3168 } 3169 3165 3170 cache = new Array(); 3166 3171 } … … 3211 3216 /*Função que grava o destinatário nos contatos dinâmicos*/ 3212 3217 function save_dynamic_contacts(array){ 3213 if(parseInt(preferences.use_dynamic_contacts)){3214 3218 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 } 3219 $.each(array, function(i, value){ 3220 var stop = false; 3221 $.each(dynamicPersonalContacts, function(x, valuex){ 3222 if(valuex.email == $(value).find("input").val().match(reComplexEmail)[1]){ 3223 stop = true; 3224 return false; 3225 } 3226 }); 3227 $.each(dynamicPersonalGroups, function(x, valuex){ 3228 if(valuex.email == $(value).find("input").val().match(reComplexEmail)[1]){ 3229 stop = true; 3230 return false; 3231 } 3232 }); 3233 if(!stop){ 3234 var exist = 0; 3235 $.each(dynamicData, function(x, valuex){ 3236 if(valuex.mail == $(value).find("input").val().match(reComplexEmail)[1]){ 3237 exist = valuex.id; 3238 return false; 3239 } 3240 }); 3241 if(exist){ 3242 REST.put("/dynamiccontact/"+exist, {name: $(value).find("input").val().split('"')[1], mail:$(value).find("input").val().match(reComplexEmail)[1]}); 3243 }else{ 3244 REST.post("/dynamiccontacts", {name: $(value).find("input").val().split('"')[1], mail:$(value).find("input").val().match(reComplexEmail)[1]}); 3245 } 3246 } 3247 }); 3248 3245 3249 } 3246 3250
Note: See TracChangeset
for help on using the changeset viewer.