From 56cbe6aee5d130eae4df33df36499f78edfe0102 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 17 Mar 2014 15:32:29 -0400 Subject: [PATCH] CRM-10693 HR-310 - Use ajax framework to view case activity & revisions --- CRM/Activity/BAO/Activity.php | 1 - CRM/Case/BAO/Case.php | 20 +++--- CRM/Case/Form/ActivityView.php | 4 +- templates/CRM/Case/Form/ActivityView.tpl | 32 ++------- templates/CRM/Case/Form/CaseView.tpl | 9 --- templates/CRM/Case/Form/Selector.tpl | 6 -- templates/CRM/Case/Page/DashboardSelector.tpl | 11 +--- templates/CRM/common/activityView.tpl | 65 ------------------- 8 files changed, 19 insertions(+), 129 deletions(-) delete mode 100644 templates/CRM/common/activityView.tpl diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index 746ddfe005..ed41e0385d 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -1968,7 +1968,6 @@ AND cl.modified_id = c.id $priorActivities[$index][$dao->activityID]['id'] = $dao->activityID; $priorActivities[$index][$dao->activityID]['name'] = $dao->name; $priorActivities[$index][$dao->activityID]['date'] = $dao->date; - $priorActivities[$index][$dao->activityID]['link'] = 'javascript:viewActivity( $dao->activityID );'; } $dao->free(); } diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index ae76dc5b8b..eaa365f106 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -1244,7 +1244,8 @@ SELECT case_status.label AS case_status, status_id, case_type.label AS case_type //check for view activity. $subject = (empty($dao->subject)) ? '(' . ts('no subject') . ')' : $dao->subject; if ($allowView) { - $subject = '' . $subject . ''; + $url = CRM_Utils_System::url('civicrm/case/activity/view', array('cid' => $contactID, 'aid' => $dao->id)); + $subject = '' . $subject . ''; } $values[$dao->id]['subject'] = $subject; @@ -1260,34 +1261,33 @@ SELECT case_status.label AS case_status, status_id, case_type.label AS case_type $values[$dao->id]['reporter'] .= ' / ' . ts('(multiple)'); } } + // FIXME: Why are we not using CRM_Core_Action for these links? This is too much manual work and likely to get out-of-sync with core markup. $url = ""; + $css = 'class="action-item crm-hover-button"'; $additionalUrl = "&id={$dao->id}"; if (!$dao->deleted) { //hide edit link of activity type email.CRM-4530. if (!in_array($dao->type, $emailActivityTypeIDs)) { //hide Edit link if activity type is NOT editable (special case activities).CRM-5871 if ($allowEdit) { - $url = '' . ts('Edit') . ' '; + $url = '' . ts('Edit') . ' '; } } if ($allowDelete) { - if (!empty($url)) { - $url .= " | "; - } - $url .= '' . ts('Delete') . ''; + $url .= ' ' . ts('Delete') . ''; } } elseif (!$caseDeleted) { - $url = '' . ts('Restore') . ''; + $url = ' ' . ts('Restore') . ''; $values[$dao->id]['status'] = $values[$dao->id]['status'] . '
(deleted)'; } //check for operations. if (self::checkPermission($dao->id, 'Move To Case', $dao->activity_type_id)) { - $url .= " | " . '' . ts('Move To Case') . ' '; + $url .= ' ' . ts('Move To Case') . ' '; } if (self::checkPermission($dao->id, 'Copy To Case', $dao->activity_type_id)) { - $url .= " | " . '' . ts('Copy To Case') . ' '; + $url .= ' ' . ts('Copy To Case') . ' '; } // if there are file attachments we will return how many and, if only one, add a link to it if (!empty($dao->attachment_ids)) { @@ -1302,7 +1302,7 @@ SELECT case_status.label AS case_status, status_id, case_type.label AS case_type NULL, FALSE ); - $url .= " | " . "" . ts('View Attachment') . ' '; + $url .= " "; } } diff --git a/CRM/Case/Form/ActivityView.php b/CRM/Case/Form/ActivityView.php index 506f19adf5..bb7de92b72 100644 --- a/CRM/Case/Form/ActivityView.php +++ b/CRM/Case/Form/ActivityView.php @@ -55,7 +55,6 @@ class CRM_Case_Form_ActivityView extends CRM_Core_Form { $activityID, 'subject' ); - $type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject); //check for required permissions, CRM-6264 if ($activityID && @@ -66,7 +65,6 @@ class CRM_Case_Form_ActivityView extends CRM_Core_Form { $this->assign('contactID', $contactID); $this->assign('caseID', $caseID); - $this->assign('type', $type); // CRM-9145 $this->assign('activityID', $activityID); @@ -108,8 +106,8 @@ class CRM_Case_Form_ActivityView extends CRM_Core_Form { } if ($revs) { + CRM_Utils_System::setTitle(ts('Activity Revision History')); $this->assign('revs', $revs); - $this->assign('result', $viewPriorActivities); $this->assign('subject', $activitySubject); $this->assign('latestRevisionID', $latestRevisionID); diff --git a/templates/CRM/Case/Form/ActivityView.tpl b/templates/CRM/Case/Form/ActivityView.tpl index 7f8e4b4fb3..c477275bfe 100644 --- a/templates/CRM/Case/Form/ActivityView.tpl +++ b/templates/CRM/Case/Form/ActivityView.tpl @@ -26,7 +26,6 @@ {* View Case Activities *} {* Uses inline styles since we have not figured out yet how to include our normal .css files. *}
{if $revs} - {$subject} ({ts}all revisions{/ts})
{strip} @@ -38,7 +37,7 @@ - + {/foreach}
{$row.name} {$row.date|crmDate}{if $row.id != $latestRevisionID}View Prior Revision{else}View Current Revision{/if}{if $row.id != $latestRevisionID}View Prior Revision{else}View Current Revision{/if}
@@ -46,7 +45,7 @@ {else} {if $report} {if $caseID} -
+
{/if} {foreach from=$report.fields item=row name=report} @@ -55,9 +54,9 @@ {if $smarty.foreach.report.first AND ( $activityID OR $parentID OR $latestRevisionID )} {* Add a cell to first row with links to prior revision listing and Prompted by (parent) as appropriate *} {else} @@ -88,25 +87,4 @@
{ts}This activity might not be attached to any case. Please investigate.{/ts}
{/if} {/if} - - -{literal} - -{/literal} diff --git a/templates/CRM/Case/Form/CaseView.tpl b/templates/CRM/Case/Form/CaseView.tpl index 098d4f1fbc..dceb9e4311 100644 --- a/templates/CRM/Case/Form/CaseView.tpl +++ b/templates/CRM/Case/Form/CaseView.tpl @@ -468,9 +468,6 @@ }); } -cj(function(){ - cj("#view-activity").hide( ); -}); {/literal} @@ -875,17 +872,11 @@ function addTags() { {/if} {* end of tag block*} -{*include activity view js file*} -{include file="CRM/common/activityView.tpl"} -
{ts}Activities{/ts}
-
-
-
{$row.value} - {if $activityID}» {ts}List all revisions{/ts}{if !$latestRevisionID}
{ts}(this is the current revision){/ts}{/if}
{/if} - {if $latestRevisionID}» {ts}View current revision{/ts}
{ts}(this is not the current revision){/ts}
{/if} - {if $parentID}» {ts}Prompted by{/ts}{/if} + {if $activityID}» {ts}List all revisions{/ts}{if !$latestRevisionID}
{ts}(this is the current revision){/ts}{/if}
{/if} + {if $latestRevisionID}» {ts}View current revision{/ts}
{ts}(this is not the current revision){/ts}
{/if} + {if $parentID}» {ts}Prompted by{/ts}{/if}
{if $row.label eq 'Details'}{$row.value|crmStripAlternatives|nl2br}{elseif $row.type eq 'Date'}{$row.value|crmDate}{else}{$row.value}{/if}
{/strip} -{*include activity view js file*} -{include file="CRM/common/activityView.tpl"} - - {if $context EQ 'Search'} {include file="CRM/common/pager.tpl" location="bottom"} {/if} diff --git a/templates/CRM/Case/Page/DashboardSelector.tpl b/templates/CRM/Case/Page/DashboardSelector.tpl index 9991549c0f..7f7c9010ca 100644 --- a/templates/CRM/Case/Page/DashboardSelector.tpl +++ b/templates/CRM/Case/Page/DashboardSelector.tpl @@ -63,13 +63,13 @@ {if $list eq 'upcoming'} {if $row.case_upcoming_activity_viewable} - {$row.case_scheduled_activity_type} + {$row.case_scheduled_activity_type} {else} {$row.case_scheduled_activity_type} {/if}    {if $row.case_upcoming_activity_editable} - + {/if}
{$row.case_scheduled_activity_date|crmDate} @@ -78,7 +78,7 @@ {elseif $list eq 'recent'} {if $row.case_recent_activity_viewable} - {$row.case_recent_activity_type} + {$row.case_recent_activity_type} {else} {$row.case_recent_activity_type} {/if} @@ -111,11 +111,6 @@ -{*include activity view js file*} -{include file="CRM/common/activityView.tpl" list=$list} -
-
-
{/strip} {* Build case details*} diff --git a/templates/CRM/common/activityView.tpl b/templates/CRM/common/activityView.tpl deleted file mode 100644 index c669eec26d..0000000000 --- a/templates/CRM/common/activityView.tpl +++ /dev/null @@ -1,65 +0,0 @@ -{* - +--------------------------------------------------------------------+ - | CiviCRM version 4.4 | - +--------------------------------------------------------------------+ - | 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 | - +--------------------------------------------------------------------+ -*} -{literal} - -{/literal} -- 2.25.1