Changeset 5358 for trunk/prototype/modules/calendar/js/helpers.js
- Timestamp:
- 01/11/12 13:28:21 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/modules/calendar/js/helpers.js
r5354 r5358 432 432 433 433 blkAddAtendee.find('li.attendee .button').addClass('small').button({text:false, icons: {primary:'ui-icon-close'}}).click(function () { 434 var participant = DataLayer.get('participant', ['AND',['=', 'user', $(this).parent().find('[type=checkbox]').val().replace(/[a-z:]/g, "")],['=', 'schedulable', $(this).parents().find('.id-event').first().val()]]); 435 if(participant) 436 DataLayer.remove('participant', participant[0].id); 434 DataLayer.remove('participant', $(this).parent().find('[type=checkbox]').val()); 437 435 $(this).parent().remove(); 438 436 }); … … 600 598 lastEditAttendeeToolTip.qtip('destroy'); 601 599 600 var userId = ''; 602 601 var newAttendeeId = ''; 603 602 604 603 if (user){ 605 if(user[0].isExternal)606 newAttendeeId = 'external:'+user[0].id;607 else608 newAttendeeId = 'internal:'+user[0].id;609 610 604 if (!skipAddNewLine) { 611 605 blkAddAtendee.find('dd.attendee-list ul.attendee-list').append( 612 DataLayer.render('templates/participants_add_itemlist.ejs', [{id:newAttendeeId, name: user[0].name, mail: user[0].mail}])606 DataLayer.render('templates/participants_add_itemlist.ejs', {user: user[0]}) 613 607 ) 614 608 .find('.button.close').addClass('small').button({text:false, icons:{primary:'ui-icon-close'}}).click(function() { 615 var participant = DataLayer.get('participant', ['AND',['=', 'user', $(this).parent().find('[type=checkbox]').val().replace(/[a-z:]/g, "")],['=', 'schedulable',$(this).parents().find('.id-event').first().val()]]); 616 if(participant) 617 DataLayer.remove('participant', participant[0].id); 609 DataLayer.remove('participant', $(this).parent().find('[type=checkbox]').val()); 618 610 $(this).parent().remove(); 619 611 }).end() … … 629 621 */ 630 622 631 newAttendeeId = DataLayer.put('user', {name: newAttendeeName, mail: newAttendeeEmail, isExternal: isExternal}); 623 userId = DataLayer.put('user', {name: newAttendeeName, mail: newAttendeeEmail, isExternal: isExternal}); 624 newAttendeeId = DataLayer.put('participant', {user: userId, isExternal: isExternal}); 632 625 633 626 634 627 blkAddAtendee.find('dd.attendee-list ul.attendee-list').append( 635 DataLayer.render('templates/participants_add_itemlist.ejs', [{id:newAttendeeId, name: newAttendeeName, mail: newAttendeeEmail }])628 DataLayer.render('templates/participants_add_itemlist.ejs', [{id:newAttendeeId, name: newAttendeeName, mail: newAttendeeEmail, isExternal: 1}]) 636 629 ).find('.button.close').addClass('small').button({text:false, icons:{primary:'ui-icon-close'}}).click(function() { 637 var participant = DataLayer.get('participant', ['AND',['=', 'user', $(this).parent().find('[type=checkbox]').val().replace(/[a-z:]/g, "")],['=', 'schedulable', $(this).parents().find('.id-event').first().val()]]); 638 if(participant) 639 DataLayer.remove('participant', participant[0].id); 630 DataLayer.remove('participant', $(this).parent().find('[type=checkbox]').val()); 640 631 $(this).parent().remove(); 641 632 }).end() … … 671 662 lastEditAttendeeToolTip.qtip("api").onShow = onShowToolTip; 672 663 664 665 666 667 668 669 670 673 671 $(this).val(''); 674 672 … … 704 702 if ($(event.target).is('input')) { 705 703 old_item = $(event.target).parents('li'); 704 newAttendeeId = DataLayer.put('participant', {user: old_item.find('.id').html(), isExternal: 0}); 706 705 blkAddAtendee.find('dd.attendee-list ul.attendee-list') 707 .append(DataLayer.render('templates/participants_add_itemlist.ejs', [{id: 'internal:'+old_item.find('.id').text(), name: old_item.find('.name').html()}]))706 .append(DataLayer.render('templates/participants_add_itemlist.ejs', [{id: newAttendeeId, name: old_item.find('.name').html(), isExternal: 0}])) 708 707 .find('.button').addClass('small').button({text:false, icons: {primary:'ui-icon-close'}}).click(function () { 709 708 $(this).parent().remove();
Note: See TracChangeset
for help on using the changeset viewer.