Merge pull request #1923 from civicrm/4.3
[civicrm-core.git] / templates / CRM / common / logButton.tpl
index d9aebb7cffab1ddcd3de373f8184d098dc426220..9a538c2c5fbc7b3c483c754fe03d5bfa6fbe41f8 100644 (file)
@@ -1,6 +1,6 @@
 {*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
 *}
 
 <a class="css_right {$snippet.css_class}" href="#" title="{ts}View Revisions{/ts}">View Revisions</a>
-<div class="dialog-{$snippet.css_class}">
-  <div class="revision-content"></div>
-</div>
 
 {literal}
 <script type="text/javascript">
-
 (function($, CRM) {
-  var options = {
-    cssDialogSelector: ".dialog-{/literal}{$snippet.css_class}{literal}",
-    contactId: {/literal}{$snippet.contact_id}{literal},
-    tableName: "{/literal}{$snippet.table_name}{literal}",
-    reportId: {/literal}{$snippet.instance_id}{literal}
-  };
-
-  $.fn.crmRevisionLink = function(options) {
-    return this.each(function(){
-      $(this).on("click", function() {
-        $(options.cssDialogSelector).show( );
-        $(options.cssDialogSelector).dialog({
-          title: "{/literal}{ts}Revisions{/ts}{literal}",
-          modal: true,
-          width: "680px",
-          bgiframe: true,
-          overlay: { opacity: 0.5, background: "black" },
-          open:function() {
-            var ajaxurl = CRM.url("civicrm/report/instance/" + options.reportId);
-            cj.ajax({
-              data: "reset=1&snippet=4&section=2&altered_contact_id_op=eq&altered_contact_id_value="+options.contactId+"&log_type_table_op=has&log_type_table_value=" + options.tableName,
-              url:  ajaxurl,
-              success: function (data) {
-                $(options.cssDialogSelector + " .revision-content").html(data);
-                if (!$(options.cssDialogSelector + " .revision-content .report-layout").length) {
-                  $(options.cssDialogSelector + " .revision-content").html("Sorry, couldn't find any revisions.");
-                }
-              }
-            });
-          },
-          buttons: {
-            "Done": function() {
-              $(this).dialog("destroy");
-            }
-          }
-        });
-      });
-    }); // this.each
-  }; // fn.crmRevisionLink
-  $(".{/literal}{$snippet.css_class}{literal}").crmRevisionLink(options);
+  if ($(".{/literal}{$snippet.css_class}{literal}").length) {
+    $(".{/literal}{$snippet.css_class}{literal}").crmRevisionLink({
+      contactId: {/literal}{$snippet.contact_id}{literal},
+      tableName: "{/literal}{$snippet.table_name}{literal}",
+      reportId: {/literal}{$snippet.instance_id}{literal}
+    });
+  }
 })(cj, CRM);
 </script>
 {/literal}