commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / templates / CRM / common / dedupe.tpl
1 {* common dupe contacts processing *}
2 <div id='processDupes' style="display:none;"></div>
3 {literal}
4 <script type='text/javascript'>
5
6 cj( '#processDupes' ).hide( );
7
8 function processDupes( cid, oid, oper, context, reloadURL ) {
9 //currently we are doing in a single way.
10 //later we might want two way operations.
11
12 if ( !cid || !oid || !oper ) return;
13
14 var title = {/literal}'{ts escape="js"}Mark as Dedupe Exception{/ts}'{literal};
15 var msg = {/literal}'{ts escape="js"}Are you sure you want to mark this pair of contacts as NOT duplicates?{/ts}'{literal};
16 if ( oper == 'nondupe-dupe' ) {
17 var title = {/literal}'{ts escape="js"}Remove Dedupe Exception{/ts}'{literal};
18 var msg = {/literal}'{ts escape="js"}Are you sure you want to remove this dedupe exception.{/ts}'{literal};
19 }
20
21 cj("#processDupes").show( );
22 cj("#processDupes").dialog({
23 title: title,
24 modal: true,
25
26 open:function() {
27 cj( '#processDupes' ).show( ).html( msg );
28 },
29
30 buttons: {
31 "Cancel": function() {
32 cj(this).dialog("close");
33 },
34 "OK": function() {
35 saveProcessDupes( cid, oid, oper, context );
36 cj(this).dialog( 'close' );
37 if ( context == 'merge-contact' && reloadURL ) {
38 // redirect after a small delay
39 setTimeout("window.location.href = '" + reloadURL + "'", 500);
40 }
41 else {
42 //CRM-15113 this has the effect of causing the alert to display. Also, as they are already 'actioned' Civi sensibly returns the browser to the
43 //search screen
44 setTimeout(function(){
45 window.location.reload();
46 }, 500);
47 }
48 }
49 }
50 });
51 }
52
53
54 function saveProcessDupes( cid, oid, oper, context ) {
55 //currently we are doing in a single way.
56 //later we might want two way operations.
57
58 if ( !cid || !oid || !oper ) return;
59
60 var statusMsg = {/literal}'{ts escape="js"}Marked as non duplicates.{/ts}'{literal};
61 if ( oper == 'nondupe-dupe' ) {
62 var statusMsg = {/literal}'{ts escape="js"}Marked as duplicates.{/ts}'{literal};
63 }
64
65 var url = {/literal}"{crmURL p='civicrm/ajax/rest' q='className=CRM_Contact_Page_AJAX&fnName=processDupes' h=0 }"{literal};
66 //post the data to process dupes.
67 cj.post( url,
68 {cid: cid, oid: oid, op: oper},
69 function( result ) {
70 if ( result.status == oper ) {
71
72 if ( oper == 'dupe-nondupe' &&
73 context == 'dupe-listing' ) {
74 oTable.fnDraw();
75 } else if ( oper == 'nondupe-dupe' ) {
76 cj( "#dupeRow_" + cid + '_' + oid ).hide( );
77 }
78 }
79 },
80 'json' );
81 }
82 </script>
83 {/literal}