CRM-14383 - Update cj closures
[civicrm-core.git] / templates / CRM / Profile / Page / MultipleRecordFieldsListing.tpl
index 75a5d839233378ccb631467977b23a77d9c1e4b6..d3805b5cd8bfea3af07f8e4d77f2d52f84228d81 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.                                    |
  |                                                                    |
  +--------------------------------------------------------------------+
 *}
 {if $showListing}
-  <h1>{ts}{$customGroupTitle}{/ts}</h1>
+  {if $dontShowTitle neq 1}<h1>{ts}{$customGroupTitle}{/ts}</h1>{/if}
+  {if $pageViewType eq 'customDataView'}
+     {assign var='dialogId' value='custom-record-dialog'}
+  {else}
+     {assign var='dialogId' value='profile-dialog'}
+  {/if}
   {if $records and $headers}
     {include file="CRM/common/jsortable.tpl"}
     <div id="browseValues">
                 <th>{ts}{$head}{/ts}</th>
               {/foreach}
               <th></th>
+              {foreach from=$dateFields key=fieldId item=v}
+                <th class='hiddenElement'></th>
+              {/foreach}
             </tr>
             </thead>
             {foreach from=$records key=recId item=rows}
               <tr class="{cycle values="odd-row,even-row"}">
                 {foreach from=$headers key=hrecId item=head}
-                  <td>{$rows.$hrecId}</td>
+                  {if $dateFieldsVals.$hrecId.$recId}
+                    <td>{$rows.$hrecId|crmDate:"%b %d, %Y %l:%M %P"}</td>
+                  {else}
+                    <td>{$rows.$hrecId}</td>
+                  {/if}
                 {/foreach}
                 <td>{$rows.action}</td>
+                {foreach from=$dateFieldsVals key=fid item=rec}
+                  {if $rec.$recId}
+                    <td class='crm-field-{$fid}_date hiddenElement'>{$rec.$recId}</td>
+                  {/if}
+                {/foreach}
               </tr>
             {/foreach}
           </table>
         {/strip}
       </div>
     </div>
-    <div id='profile-dialog' class="hiddenElement"></div>
+    <div id='{$dialogId}' class="hiddenElement"></div>
   {elseif !$records}
     <div class="messages status no-popup">
       <div class="icon inform-icon"></div>
       &nbsp;
       {ts 1=$customGroupTitle}No records of type '%1' found.{/ts}
     </div>
-    <div id='profile-dialog' class="hiddenElement"></div>
+    <div id='{$dialogId}' class="hiddenElement"></div>
   {/if}
 
   {if !$reachedMax}
-    <a accesskey="N" href="{crmURL p='civicrm/profile/edit' q="reset=1&id=`$contactId`&multiRecord=add&gid=`$gid`&snippet=1&context=multiProfileDialog&onPopupClose=`$onPopupClose`"}"
+    {if $pageViewType eq 'customDataView'}
+      <br/><a accesskey="N" title="{ts 1=$customGroupTitle}Add %1 Record{/ts}" href="{crmURL p='civicrm/contact/view/cd/edit' q="reset=1&type=$ctype&groupID=$customGroupId&entityID=$contactId&cgcount=$cgcount&multiRecordDisplay=single&mode=add"}" 
+       class="button action-item"><span><div class="icon add-icon"></div>{ts 1=$customGroupTitle}Add %1 Record{/ts}</span></a>
+    {else}
+      <a accesskey="N" href="{crmURL p='civicrm/profile/edit' q="reset=1&id=`$contactId`&multiRecord=add&gid=`$gid`&context=multiProfileDialog&onPopupClose=`$onPopupClose`"}"
        class="button action-item"><span><div class="icon add-icon"></div>{ts}Add New Record{/ts}</span></a>
+    {/if}
   {/if}
 {/if}
-{literal}
-  <script type='text/javascript'>
-    cj(function () {
-      function formDialog(dataURL, dialogTitle) {
-        cj.ajax({
-          url: dataURL,
-          success: function (content) {
-            cj('#profile-dialog').show().html(content).dialog({
-              title: dialogTitle,
-              modal: true,
-              width: 680,
-              overlay: {
-                opacity: 0.5,
-                background: "black"
-              },
-
-            close: function (event, ui) {
-              cj('#profile-dialog').html('');
-            }
-          });
-          cj('.action-link').hide();
-          cj('#profile-dialog #crm-profile-block .edit-value label').css('display', 'inline');
-        }});
-      }
-
-      var profileName = {/literal}"{$ufGroupName}"{literal};
-      cj('.action-item').each(function () {
-        if (!cj(this).attr('jshref')) {
-          cj(this).attr('jshref', cj(this).attr('href'));
-          cj(this).attr('href', '#browseValues');
-        }
-      });
-
-      cj(".crm-profile-name-" + profileName + " .action-item").click(function () {
-        dataURL = cj(this).attr('jshref');
-        dialogTitle = cj(this).attr('title');
-        formDialog(dataURL, dialogTitle);
-      });
-    });
-    </script>
-  {/literal}