Merge pull request #2678 from monishdeb/CRM-14351
[civicrm-core.git] / templates / CRM / Contact / Page / View / Note.tpl
index 6dc07d0e38832e8a3d3891c7e995ae4b2e2dbfe9..350a713c190cd945b1274b457d65ee14d1adc626 100644 (file)
@@ -38,7 +38,7 @@
                {include file="CRM/Form/attachment.tpl"}
             {/if}
           </table>
-          <div class="crm-submit-buttons"><input type="button" name='cancel' value="{ts}Done{/ts}" onclick="location.href='{crmURL p='civicrm/contact/view' q='action=browse&selectedChild=note'}';"/></div>
+          <div class="crm-submit-buttons"><input type="submit" class='cancel form-submit' value="{ts}Done{/ts}"/></div>
 
         {if $comments}
         <fieldset>
 
 {/if}
 
-{if $permission EQ 'edit' AND ($action eq 16 or $action eq 4 or $action eq 8)}
+{if $permission EQ 'edit' AND ($action eq 16)}
    <div class="action-link">
-   <a accesskey="N" href="{crmURL p='civicrm/contact/view/note' q="cid=`$contactId`&action=add"}" class="button"><span><div class="icon add-icon"></div>{ts}Add Note{/ts}</span></a>
+   <a accesskey="N" href="{crmURL p='civicrm/contact/view/note' q="cid=`$contactId`&action=add"}" class="button medium-popup"><span><div class="icon add-icon"></div>{ts}Add Note{/ts}</span></a>
    </div>
    <div class="clear"></div>
 {/if}
 <div class="crm-content-block">
 
-{if $notes}
+{if $notes and $action eq 16}
 
 <script type="text/javascript">
     var commentAction = '{$commentAction|escape:quotes}'
                         + response['values'][i].modified_date
                         + '</td><td>'
                         + '<a href="'+ urlTemplate + response['values'][i].createdById +'">'+ response['values'][i].createdBy +'</a>'
+                        + '</td><td>' // FIXME: attachments
                         + '</td><td>'+ commentAction.replace(/{cid}/g, response['values'][i].createdById).replace(/{id}/g, response['values'][i].id) +'</td></tr>'
 
                     commentRows['cnote_'+ noteId][response['values'][i].id] = str;
           <th>{ts}Subject{/ts}</th>
           <th>{ts}Date{/ts}</th>
           <th>{ts}Created By{/ts}</th>
+          <th>{ts}Attachment(s){/ts}</th>
           <th></th>
         </tr>
         </thead>
             <td class="crm-note-createdBy">
                 <a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$note.contact_id`"}">{$note.createdBy}</a>
             </td>
+            <td class="crm-note-attachment">
+                {foreach from=$note.attachment item=fileinfo}
+                  {$fileinfo}
+                {/foreach}
+            </td>
             <td class="nowrap">{$note.action|replace:'xx':$note.id}</td>
         </tr>
         {/foreach}
     {/strip}
  </div>
 </div>
-{elseif ! ($action eq 1)}
+{elseif ($action eq 16)}
    <div class="messages status no-popup">
         <div class="icon inform-icon"></div>
-        {capture assign=crmURL}{crmURL p='civicrm/contact/view/note' q="cid=`$contactId`&action=add"}{/capture}
-        {ts 1=$crmURL}There are no Notes for this contact. You can <a accesskey="N" href='%1'>add one</a>.{/ts}
+        {capture assign=link}class="action-item medium-popup" accesskey="N" href="{crmURL p='civicrm/contact/view/note' q="cid=`$contactId`&action=add"}"{/capture}
+        {ts 1=$link}There are no Notes for this contact. You can <a %1>add one</a>.{/ts}
    </div>
 {/if}
 </div>