CRM-14383 - Update cj closures
[civicrm-core.git] / templates / CRM / Case / Form / Activity.tpl
index 9ee48c06ae19bf23601b3c50f8a8c4c097e2ea1c..f5c044f6c8cb0e94f96615d7dea211d170223a57 100644 (file)
@@ -1,8 +1,8 @@
 {*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
 {if $cdType }
   {include file="CRM/Custom/Form/CustomData.tpl"}
 {else}
-<h3>{if $action eq 1 or $action eq 1024}
-  {ts 1=$activityTypeName}New activity: %1{/ts}
-  {elseif $action eq 8}{ts 1=$activityTypeName}Delete %1{/ts}
-  {elseif $action eq 32768}{ts 1=$activityTypeName}Restore %1{/ts}
-  {else}{ts 1=$activityTypeName}Edit %1{/ts}{/if}
-</h3>
 <div class="crm-block crm-form-block crm-case-activity-form-block">
 
   {if $action neq 8 and $action  neq 32768 }
   <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
 
     {* added onload javascript for source contact*}
-    {literal}
-    <script type="text/javascript">
-    var assignee_contact = '';
-
-    {/literal}
-    {if $assignee_contact}
-    var assignee_contact = {$assignee_contact};
-    {/if}
-
-    {literal}
-    var assignee_contact_id = null;
-    //loop to set the value of cc and bcc if form rule.
-    var toDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1&noemail=1' h=0 }{literal}"; {/literal}
-    {foreach from=","|explode:"assignee" key=key item=element}
-      {assign var=currentElement value=`$element`_contact_id}
-      {if $form.$currentElement.value}
-        {literal} var {/literal}{$currentElement}{literal} = cj.ajax({ url: toDataUrl + "&cid={/literal}{$form.$currentElement.value}{literal}", async: false }).responseText;{/literal}
-      {/if}
-    {/foreach}
-    {literal}
-
-    if ( assignee_contact_id ) {
-      eval( 'assignee_contact = ' + assignee_contact_id );
-    }
-
-    cj(function( ) {
-      {/literal}
-      {if $source_contact and $admin and $action neq 4}
-        {literal} cj( '#source_contact_id' ).val( "{/literal}{$source_contact}{literal}");{/literal}
-      {/if}
-      {literal}
-
-      var sourceDataUrl = "{/literal}{$dataUrl}{literal}";
-      var tokenDataUrl_assignee  = "{/literal}{$tokenUrl}&context=case_activity_assignee{literal}";
-
-      var hintText = "{/literal}{ts escape='js'}Type in a partial or complete name or email address of an existing contact.{/ts}{literal}";
-      cj( "#assignee_contact_id").tokenInput( tokenDataUrl_assignee, { prePopulate: assignee_contact, theme: 'facebook', hintText: hintText });
-      cj( 'ul.token-input-list-facebook, div.token-input-dropdown-facebook' ).css( 'width', '450px' );
-      cj( "#source_contact_id").autocomplete( sourceDataUrl, { width : 180, selectFirst : false, matchContains:true
-      }).result( function(event, data, formatted) { cj( "#source_contact_qid" ).val( data[1] );
-        }).bind( 'click', function( ) { cj( "#source_contact_qid" ).val(''); });
-    });
-  </script>
-  {/literal}
+    {include file="CRM/Activity/Form/ActivityJs.tpl" tokenContext="case_activity"}
 
   {/if}
 
       <tr class="crm-case-activity-form-block-target_contact_id hide-block" id="with-contacts-widget">
         <td class="label font-size10pt">{ts}With Contact{/ts}</td>
         <td class="view-value">
-          {include file="CRM/Contact/Form/NewContact.tpl" noLabel=true skipBreak=true multiClient=true}
+          {$form.target_contact_id.html}
           <br/>
           <a href="#" class="crm-with-contact">
             &raquo; {if not $multiClient}{ts}With client{/ts}{else}{ts}With client(s){/ts}{/if}
     </tr>
     <tr class="crm-case-activity-form-block-source_contact_id">
       <td class="label">{$form.source_contact_id.label}</td>
-      <td class="view-value"> {if $admin}{$form.source_contact_id.html}{/if}</td>
+      <td class="view-value">{$form.source_contact_id.html}</td>
     </tr>
     <tr class="crm-case-activity-form-block-assignee_contact_id">
-      <td class="label">{ts}Assigned To{/ts}</td>
+      <td class="label">
+        {$form.assignee_contact_id.label}
+        {edit}{help id="assignee_contact_id" title=$form.assignee_contact_id.label file="CRM/Activity/Form/Activity"}{/edit}
+      </td>
       <td>{$form.assignee_contact_id.html}
-        {edit}
-          <span class="description">
-          {ts}You can optionally assign this activity to someone.{/ts}
-          {if $activityAssigneeNotification}
-            <br />{ts}A copy of this activity will be emailed to each Assignee.{/ts}
-          {/if}
-          </span>
-        {/edit}
+        {if $activityAssigneeNotification}
+          <br />
+          <span class="description"><span class="icon email-icon"></span>{ts}A copy of this activity will be emailed to each Assignee.{/ts}</span>
+        {/if}
       </td>
     </tr>
 
               <td class="label">{$form.followup_activity_subject.label}</td>
               <td>{$form.followup_activity_subject.html|crmAddClass:huge}</td>
             </tr>
+           <tr>
+              <td class="label">
+                {$form.followup_assignee_contact_id.label}
+                {edit}
+                {/edit}
+              </td>
+              <td>
+                {$form.followup_assignee_contact_id.html}
+              </td>
+            </tr>
           </table>
         </div><!-- /.crm-accordion-body -->
       </div><!-- /.crm-accordion-wrapper -->
     <td class="label">{$form.duration.label}</td>
     <td class="view-value">
       {$form.duration.html}
-      <span class="description">{ts}Total time spent on this activity (in minutes).{/ts}
+      <span class="description">{ts}minutes{/ts}
     </td>
   </tr>
   {* Suppress activity status and priority for changes to status, case type and start date. PostProc will force status to completed. *}
     {if $form.tag.html}
     <tr class="crm-case-activity-form-block-tag">
       <td class="label">{$form.tag.label}</td>
-      <td class="view-value"><div class="crm-select-container">{$form.tag.html}</div>
-        {literal}
-          <script type="text/javascript">
-            cj(".crm-case-activity-form-block-tag select[multiple]").crmasmSelect({
-              addItemTarget: 'bottom',
-              animate: true,
-              highlight: true,
-              sortable: true,
-              respectParents: true
-            });
-          </script>
-        {/literal}
-
+      <td class="view-value">
+        <div class="crm-select-container">{$form.tag.html}</div>
       </td>
     </tr>
     {/if}
   {include file="CRM/common/customData.tpl"}
     {literal}
     <script type="text/javascript">
-    cj(function() {
+    CRM.$(function($) {
     {/literal}
     {if $customDataSubType}
       CRM.buildCustomData( '{$customDataType}', {$customDataSubType} );
   {if $action eq 2 or $action eq 1}
     {literal}
     <script type="text/javascript">
-      cj(function( ) {
+      CRM.$(function($) {
         cj('.crm-with-contact').click(function(){
           cj('#with-contacts-widget').toggle();
           cj('#with-clients').toggle();
+          return false;
         });
       });
     </script>