CRM-14949 - Move more stuff into dynamic js tpl
[civicrm-core.git] / templates / CRM / common / jcalendar.tpl
index 88f9bc7304c20e2827ac3757cfcaf0a94af8aec8..b4e25f3d0dbd02e30298f4fdd47330ee1aa42daf 100644 (file)
@@ -1,8 +1,8 @@
 {*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -43,7 +43,9 @@
         {$form.$blockSection.$blockId.$tElement.html|crmAddClass:six}
     {/if}
 {else}
-    {assign var='elementId'   value=$form.$elementName.id}
+    {if !$elementId}
+      {assign var='elementId'   value=$form.$elementName.id}
+    {/if}
     {assign var="timeElement" value=$elementName|cat:'_time'}
     {$form.$elementName.html}
 {/if}
@@ -69,7 +71,7 @@
 
 <script type="text/javascript">
     {literal}
-    cj( function() {
+    CRM.$(function($) {
       {/literal}
       var element_date   = "#{$displayDate}";
       var element_time  = "#{$elementId}_time";
       // format date according to display field
       displayDateValue = cj.datepicker.formatDate( date_format, displayDateValue );
       cj( element_date).val( displayDateValue );
+      //support unsaved-changes warning: CRM-14353
+      cj( element_date).data('crm-initial-value', displayDateValue);
 
       cj(element_date).click( function( ) {
           hideYear( this );