<__trans phrase="You have added [_1] to your address book." params="<$mt:var name="saved" escape="html"$>"> <__trans phrase="You have successfully deleted the selected contacts from your address book."> var current_edit = 0; var old_note_email = ''; var old_note_url = ''; function edit_note(id) { if (current_edit) return; var note_links = new Array(); note_links.push( jQuery('#note-email-link-' + id) ); note_links.push( jQuery('#note-url-link-' + id) ); var note_fields = new Array(); note_fields.push( jQuery('#note-email-field-' + id) ); note_fields.push( jQuery('#note-url-field-' + id) ); var $note_email = jQuery('#note-email-' + id); var $note_url = jQuery('#note-url-' + id); if (!note_links.length || !note_fields.length || !$note_email) return; current_edit = id; old_note_email = $note_email.val(); old_note_url = $note_url.val(); for (i=0;i<2;++i) { note_links[i].hide(); note_fields[i].show(); } $note_email.focus(); $note_email.select(); return false; } function cancel_edit(id) { var note_links = new Array(); note_links.push( jQuery('#note-email-link-' + id) ); note_links.push( jQuery('#note-url-link-' + id) ); var note_fields = new Array(); note_fields.push( jQuery('#note-email-field-' + id) ); note_fields.push( jQuery('#note-url-field-' + id) ); var $note_email = jQuery('#note-email-' + id); var $note_url = jQuery('#note-url-' + id); if (!note_links.length || !note_fields.length || !$note_email) return; $note_email.val( old_note_email ); old_note_email = ''; $note_url.val( old_note_url ); old_note_url = ''; current_edit = 0; for (i=0;i<2;++i) { note_links[i].show(); note_fields[i].hide(); } $note_email.mtUnvalidate(); $note_url.mtUnvalidate(); return false; } function submit_edit(id) { if ((0 != current_edit) && (id != current_edit)) id = current_edit; // if old email matches new email, ignore submission (same as cancel) // if new email is already in our noteList array, warn user // if not in noteList and not in range of noteList notes, check with server. var $note_email = jQuery('#note-email-' + id); var $note_url = jQuery('#note-url-' + id); if ( !$note_email.val() || !$note_email.mtValidate() ) return false; if ( $note_url.val() && !$note_url.mtValidate() ) return false; var new_note_email = $note_email.val(); var new_note_url = $note_url.val(); if ((old_note_email == new_note_email) && (old_note_url == new_note_url)) { cancel_edit(id); return false; } $note_email.mtUnvalidate(); $note_url.mtUnvalidate(); return submit_edit_form(id); } function submit_edit_form(id) { var note_email = jQuery('#note-email-' + id).val(); var note_url = jQuery('#note-url-' + id).val(); renderList({ __mode: 'save', _type: 'notification', email: note_email, url: note_url, id: id, forward_list: 1, magic_token: 1 }); cancelCreateMode(); return false; } function setCreateMode () { jQuery('#create-inline-notification').show(); jQuery('#url').val(''); jQuery('#email').val('').focus(); jQuery('#content-actions').hide(); } function cancelCreateMode () { jQuery('#create-inline-notification').hide(); jQuery('#create-inline-notification input').mtUnvalidate(); jQuery('#content-actions').show(); current_edit = 0; } jQuery('#submit-new-contact').click(function() { if ( !jQuery('#create-inline-notification input').mtValidate('simple') ) return false; renderList({ __mode: 'save', _type: 'notification', email: jQuery('#email').val(), url: jQuery('#url').val(), forward_list: 1, magic_token: 1 }); cancelCreateMode(); return false; }); jQuery('#create-inline-notification button.mt-cancel-action').click(function() { cancelCreateMode(); return false; }); jQuery('#action-create-contact').click( function() { setCreateMode(); return false; }); jQuery('.start-edit').live('click', function () { jQuery(this).attr('href').match(/#(\d+)/); var id = RegExp.$1; edit_note(id); return false; }); jQuery('.cancel-edit').live('click', function () { jQuery(this).attr('href').match(/#(\d+)/); var id = RegExp.$1; cancel_edit(id); return false; }); jQuery('.submit-note').live('click', function () { jQuery(this).attr('href').match(/#(\d+)/); var id = RegExp.$1; submit_edit(id); return false; });