CRM-12915, common js file for CiviHR to load revisions inside a tab
authorDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Sun, 28 Jul 2013 14:33:36 +0000 (20:03 +0530)
committerDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Sun, 28 Jul 2013 14:33:36 +0000 (20:03 +0530)
----------------------------------------
* CRM-12915: Improve layout of revision-history for multi-row CustomGroups
  http://issues.civicrm.org/jira/browse/CRM-12915

templates/CRM/common/logButton.tpl [new file with mode: 0644]

diff --git a/templates/CRM/common/logButton.tpl b/templates/CRM/common/logButton.tpl
new file mode 100644 (file)
index 0000000..9b9eea0
--- /dev/null
@@ -0,0 +1,75 @@
+{*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.3                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2013                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+*}
+
+{*
+  Usage: CRM_Core_Region::instance('...')->add(array(
+  'template' => 'CRM/common/LogButton.tpl',
+  'instance_id' => CRM_Report_Utils_Report::getInstanceIDForValue('logging/contact/summary'),
+  'css_class' => 'hrqual-revision-link',
+  'table_name' => 'my_table',
+  'contact_id' => 123,
+  ));
+
+  Note: This file is used by CivHR
+*}
+
+<a class="css_right {$snippet.css_class}" href="#" title="{ts}View Revisions{/ts}">Revisions</a>
+<div class="dialog-{$snippet.css_class}">
+  <div class="revision-content"></div>
+</div>
+
+{literal}
+<script type="text/javascript">
+cj(document).on("click", ".{/literal}{$snippet.css_class}{literal}", function() {
+  cj(".dialog-{/literal}{$snippet.css_class}{literal}").show( );
+  cj(".dialog-{/literal}{$snippet.css_class}{literal}").dialog({
+    title: "{/literal}{ts}Revisions{/ts}{literal}",
+    modal: true,
+    width: "680px",
+    height: "380",
+    bgiframe: true,
+    overlay: { opacity: 0.5, background: "black" },
+    open:function() {
+      var url = CRM.url("civicrm/report/instance/{/literal}{$snippet.instance_id}{literal}", {
+        reset:1,
+        snippet:4,
+        section:2,
+        altered_contact_id_op:"eq",
+        altered_contact_id_value:"{/literal}{$snippet.contact_id}{literal}",
+        log_type_table_op:"has",
+        log_type_table_value:"{/literal}{$snippet.table_name}{literal}"
+      });
+      cj(".revision-content", this).load(url);
+    },
+    buttons: {
+      "Done": function() {
+        cj(this).dialog("destroy");
+      }
+    }
+  });
+});
+</script>
+{/literal}