}
if ($allowEdit) {
- $values[$dao->id]['status'] = '<a class="crm-activity-status crm-activity-status-' . $dao->id . ' ' . $values[$dao->id]['class'] . ' crm-activity-change-status crm-editable-enabled" activity_id=' . $dao->id . ' current_status=' . $dao->status . ' case_id=' . $caseID . ' href="#" title=\'' . $statusTitle . '\'>' . $values[$dao->id]['status'] . '</a>';
+ $values[$dao->id]['status'] = '<div class="crmf-status_id crm-activity-status-' . $dao->id . ' ' . $values[$dao->id]['class'] . ' crm-editable" data-type="select" data-action="create" data-refresh="true">' . $values[$dao->id]['status'] . '</div>';
}
}
$dao->free();
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
- +--------------------------------------------------------------------+
- | 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 |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
- * $Id$
- *
- */
-
-/**
- * This class generates form components for building changing activity status interface in a case
- *
- */
-class CRM_Case_Form_ActivityChangeStatus extends CRM_Core_Form {
-
- /**
- * Build the form object
- *
- * @return void
- */
- public function buildQuickForm() {
- $activityStatus = CRM_Core_PseudoConstant::activityStatus();
- $this->add('select', 'activity_change_status', ts('New Status'), $activityStatus);
- }
-
-}
<path>civicrm/ajax/delcaserole</path>
<page_callback>CRM_Case_Page_AJAX::deleteCaseRoles</page_callback>
</item>
- <item>
- <path>civicrm/case/changeactivitystatus</path>
- <title>Change Activity Status</title>
- <page_callback>CRM_Case_Form_ActivityChangeStatus</page_callback>
- </item>
</menu>
$case_id = '';
$createRevision = FALSE;
$oldActivityValues = array();
+ // Lookup case id if not supplied
+ if (!isset($params['case_id']) && !empty($params['id'])) {
+ $params['case_id'] = CRM_Core_DAO::singleValueQuery("SELECT case_id FROM civicrm_case_activity WHERE activity_id = " . (int) $params['id']);
+ }
if (!empty($params['case_id'])) {
$case_id = $params['case_id'];
if (!empty($params['id'])) {
+++ /dev/null
-{*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
- +--------------------------------------------------------------------+
- | 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 |
- +--------------------------------------------------------------------+
-*}
-{* CiviCase - change activity status inline *}
-<div class="crm-block crm-form-block crm-case-activitychangestatus-form-block">
- <table class="form-layout">
- <tr class="crm-case-activitychangestatus-form-block-status">
- <td class="label">{$form.activity_change_status.label}</td>
- <td>{$form.activity_change_status.html}</td>
- </tr>
- </table>
-</div>
+++ /dev/null
-{*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
- +--------------------------------------------------------------------+
- | 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 |
- +--------------------------------------------------------------------+
-*}
-{* CiviCase - change activity status inline *}
-{literal}
- <script type="text/javascript">
- CRM.$(function($) {
- // Elements are sometimes in a jQuery dialog box which is outside crm-container,
- // So gotta attach this handler to the whole body - sorry.
- $('body').off('click.changeActivityStatus');
- $('body').on('click.changeActivityStatus', 'a.crm-activity-change-status', function() {
- var link = $(this),
- activityId = $(this).attr('activity_id'),
- current_status_id = $(this).attr('current_status'),
- caseId = $(this).attr('case_id'),
- data = 'snippet=1&reset=1',
- $el = $('<div class="crm-activity_change_status"></div>');
- $el.block();
-
- $el.load(CRM.url('civicrm/case/changeactivitystatus'), data, function() {
- $el.unblock().trigger('crmLoad');
- $("#activity_change_status").val(current_status_id);
- });
-
- CRM.confirm({
- title: {/literal}'{ts escape='js'}Change Activity Status{/ts}'{literal},
- message: $el
- })
- .on('crmConfirm:yes', function() {
- // update the status
- var status_id = $("#activity_change_status").val();
- if (status_id === current_status_id) {
- return false;
- }
-
- var dataUrl = CRM.url('civicrm/ajax/rest');
- var data = 'json=1&version=3&entity=Activity&action=update&id=' + activityId + '&status_id=' + status_id
- + '&case_id=' + caseId;
- var request = $.ajax({
- type : 'POST',
- dataType : 'json',
- url : dataUrl,
- data : data,
- success : function(values) {
- if (values.is_error) {
- CRM.alert(values.error_message, {/literal}'{ts escape='js'}Unable to change status{/ts}'{literal}, 'error');
- return false;
- }
- else {
- CRM.refreshParent(link);
- }
- },
- error : function(jqXHR) {
- CRM.alert(jqXHR.responseText, jqXHR.statusText, 'error');
- return false;
- }
- });
- CRM.status({}, request);
- });
- return false;
- });
- });
- </script>
-{/literal}
<div id="activities" class="crm-accordion-body">
<div class="crm-accordion-wrapper crm-accordion-inner crm-search_filters-accordion collapsed">
<div class="crm-accordion-header">
- {ts}Search Filters{/ts}</a>
+ {ts}Search Filters{/ts}
</div><!-- /.crm-accordion-header -->
<div class="crm-accordion-body">
<table class="no-border form-layout-compressed" id="searchOptions">
</td>
<td style="vertical-align: bottom;">
{assign var=caseid value=$caseID}
- <span class="crm-button"><input class="crm-form-submit default" name="_qf_Basic_refresh" value="Search" type="button" onclick="buildCaseActivities( true,{$caseid} )"; /></span>
+ <span class="crm-button crm-icon-button">
+ <span class="crm-button-icon ui-icon-check"></span>
+ <input class="crm-form-submit default" name="_qf_Basic_refresh" value="{ts}Search{/ts}" type="button" data-case-id="{$caseid}" />
+ </span>
</td>
</tr>
<tr>
{literal}
<script type="text/javascript">
CRM.$(function($) {
- buildCaseActivities(false,{/literal}{$caseID}{literal});
-});
-
-function buildCaseActivities(filterSearch , CaseId) {
- if (filterSearch) {
- oTable.fnDestroy();
- }
- var count = 0;
- var columns = '';
- var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/activity' h=0 q='snippet=4&caseID='}"{literal}+CaseId;
- sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
- sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
+ var CaseId = {/literal}{$caseID}{literal};
+ buildCaseActivities(false);
+ $('input.crm-form-submit[data-case-id=' + CaseId + ']').click(buildCaseActivities);
- CRM.$('#case_id_'+CaseId+' th').each(function( ) {
- if (CRM.$(this).attr('id') != 'nosort') {
- columns += '{"sClass": "' + CRM.$(this).attr('class') +'"},';
- }
- else {
- columns += '{ "bSortable": false },';
+ function buildCaseActivities(filterSearch) {
+ if (filterSearch) {
+ oTable.fnDestroy();
}
- count++;
- });
+ var count = 0;
+ var columns = '';
+ var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/activity' h=0 q='snippet=4&caseID='}"{literal}+CaseId;
+ sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
+ sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
- columns = columns.substring(0, columns.length - 1 );
- eval('columns =[' + columns + ']');
+ $('#case_id_'+CaseId+' th').each(function( ) {
+ if ($(this).attr('id') != 'nosort') {
+ columns += '{"sClass": "' + $(this).attr('class') +'"},';
+ }
+ else {
+ columns += '{ "bSortable": false },';
+ }
+ count++;
+ });
- oTable = CRM.$('#case_id_'+CaseId).dataTable({
- "bFilter" : false,
- "bAutoWidth" : false,
- "aaSorting" : [],
- "aoColumns" : columns,
- "bProcessing": true,
- "bJQueryUI": true,
- "asStripClasses" : [ "odd-row", "even-row" ],
- "sPaginationType": "full_numbers",
- "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
- "bServerSide": true,
- "sAjaxSource": sourceUrl,
- "iDisplayLength": 10,
- "bDestroy": true,
- "fnDrawCallback": function() { setSelectorClass(CaseId); },
- "fnServerData": function ( sSource, aoData, fnCallback ) {
+ columns = columns.substring(0, columns.length - 1 );
+ eval('columns =[' + columns + ']');
- if ( filterSearch ) {
- var activity_deleted = 0;
- if ( CRM.$("#activity_deleted_"+CaseId+":checked").val() == 1 ) {
- activity_deleted = 1;
+ oTable = $('#case_id_'+CaseId).dataTable({
+ "bFilter" : false,
+ "bAutoWidth" : false,
+ "aaSorting" : [],
+ "aoColumns" : columns,
+ "bProcessing": true,
+ "bJQueryUI": true,
+ "asStripClasses" : [ "odd-row", "even-row" ],
+ "sPaginationType": "full_numbers",
+ "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
+ "bServerSide": true,
+ "sAjaxSource": sourceUrl,
+ "iDisplayLength": 10,
+ "bDestroy": true,
+ "fnDrawCallback": function() {
+ setSelectorClass();
+ setRowIds();
+ // FIXME: trigger crmLoad and crmEditable would happen automatically
+ $('.crm-editable', '#case_id_'+CaseId).crmEditable();
+ },
+ "fnServerData": function ( sSource, aoData, fnCallback ) {
+
+ if ( filterSearch ) {
+ var activity_deleted = 0;
+ if ( $("#activity_deleted_"+CaseId+":checked").val() == 1 ) {
+ activity_deleted = 1;
+ }
+ aoData.push(
+ {name:'status_id', value: $("select#status_id_"+CaseId).val()},
+ {name:'reporter_id', value: $("select#reporter_id_"+CaseId).val()},
+ {name:'activity_type_id', value: $("select#activity_type_filter_id_"+CaseId).val()},
+ {name:'activity_date_low', value: $("#activity_date_low_"+CaseId).val()},
+ {name:'activity_date_high', value: $("#activity_date_high_"+CaseId).val() },
+ {name:'activity_deleted', value: activity_deleted }
+ );
}
- aoData.push(
- {name:'status_id', value: CRM.$("select#status_id_"+CaseId).val()},
- {name:'reporter_id', value: CRM.$("select#reporter_id_"+CaseId).val()},
- {name:'activity_type_id', value: CRM.$("select#activity_type_filter_id_"+CaseId).val()},
- {name:'activity_date_low', value: CRM.$("#activity_date_low_"+CaseId).val()},
- {name:'activity_date_high', value: CRM.$("#activity_date_high_"+CaseId).val() },
- {name:'activity_deleted', value: activity_deleted }
- );
+ $.ajax( {
+ "dataType": 'json',
+ "type": "POST",
+ "url": sSource,
+ "data": aoData,
+ "success": fnCallback
+ } );
}
- CRM.$.ajax( {
- "dataType": 'json',
- "type": "POST",
- "url": sSource,
- "data": aoData,
- "success": fnCallback
- } );
- }
- });
-}
+ });
+ }
-function setSelectorClass(CaseId) {
- CRM.$("#case_id_"+CaseId+" td:last-child").each( function( ) {
- CRM.$(this).parent().addClass(CRM.$(this).text() );
- });
-}
+ function setRowIds() {
+ $("#case_id_"+CaseId+" tbody tr").each(function() {
+ var link, id;
+ link = $('a.action-item', this).attr('href');
+ if (link) {
+ id = link.match(/&id=(\d+)/);
+ }
+ if (id) {
+ $(this)
+ .addClass('crm-entity')
+ .data('entity', 'activity')
+ .data('id', id[1]);
+ }
+ });
+ }
+
+ function setSelectorClass() {
+ $("#case_id_"+CaseId+" td:last-child").each(function() {
+ $(this).parent().addClass($(this).text());
+ });
+ }
+});
</script>
{/literal}
{include file="CRM/Case/Form/ActivityTab.tpl"}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
-
- {include file="CRM/Case/Form/ActivityChangeStatusJs.tpl"}
{/if} {* view related cases if end *}
</div>
</div>
{/if}
{/if}
-
-{include file="CRM/Case/Form/ActivityChangeStatusJs.tpl"}
{counter start=0 skip=1 print=false}
{foreach from=$rows item=row}
- <tr class="{$row.class}">
+ <tr class="crm-entity {$row.class}" data-entity="activity" data-id="{$row.id}">
<td class="crm-case-display_date">{$row.display_date}</td>
<td class="crm-case-subject">{$row.subject}</td>
<td class="crm-case-type">{$row.type}</td>
{/if}
{/if}
</div>
-
-{include file="CRM/Case/Form/ActivityChangeStatusJs.tpl"}
<script type="text/javascript">
function {/literal}{$context}{$list}{literal}CaseDetails( caseId, contactId, type, context )
{
- var dataUrl = {/literal}"{crmURL p='civicrm/case/details' h=0 q='snippet=4&caseId='}{literal}" + caseId +'&cid=' + contactId + '&type=' + type;
- cj.ajax({
- url : dataUrl,
- dataType: "html",
- timeout : 5000, //Time in milliseconds
- success : function( data ){
- cj( '#'+ context + '-' + type +'-casedetails-' + caseId ).html( data );
- },
- error : function( XMLHttpRequest, textStatus, errorThrown ) {
- CRM.console('error', 'Error: ', textStatus);
- }
- });
+ var dataUrl = CRM.url('civicrm/case/details', {caseId: caseId, cid: contactId, type: type});
+ CRM.loadPage(dataUrl, {target: '#'+ context + '-' + type +'-casedetails-' + caseId});
}
function showCaseActivities( caseId, type, context ) {
</script>
{/literal}
-
-{include file="CRM/Case/Form/ActivityChangeStatusJs.tpl"}
{if $rows}
{include file="CRM/Case/Form/Selector.tpl"}
- {include file="CRM/Case/Form/ActivityChangeStatusJs.tpl"}
{else}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>