Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
819d0d41 | 3 | | CiviCRM version 4.5 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
819d0d41 | 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
6 | +--------------------------------------------------------------------+ |
7 | | This file is a part of CiviCRM. | | |
8 | | | | |
9 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
10 | | under the terms of the GNU Affero General Public License | | |
11 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
12 | | | | |
13 | | CiviCRM is distributed in the hope that it will be useful, but | | |
14 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
16 | | See the GNU Affero General Public License for more details. | | |
17 | | | | |
18 | | You should have received a copy of the GNU Affero General Public | | |
19 | | License and the CiviCRM Licensing Exception along | | |
20 | | with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
25 | *} | |
26 | {* this template is used for adding/editing/deleting case *} | |
27 | {if $addCaseContact } | |
28 | {include file="CRM/Contact/Form/AddContact.tpl"} | |
29 | {else} | |
30 | ||
31 | <fieldset> | |
32 | {if $action eq 1} | |
33 | <legend>{ts}New Case{/ts}</legend> | |
34 | {elseif $action eq 2} | |
35 | <legend>{ts}Edit Case{/ts}</legend> | |
36 | {elseif $action eq 8 and !$context} | |
37 | <legend>{ts}Delete Case{/ts}</legend> | |
38 | {elseif $action eq 8 and $context} | |
39 | <legend>{ts}Detach Activity From Case{/ts}</legend> | |
40 | {/if} | |
41 | <div class="form-item"> | |
42 | <table class="form-layout-compressed"> | |
43 | ||
44 | {if $action eq 8 and $context} | |
45 | <div class="status">{ts}Are you sure you want to detach this case from Activity?{/ts}</div> | |
46 | {elseif $action eq 8 and !$context} | |
47 | <div class="status">{ts}Are you sure you want to delete this case?{/ts} {ts}This action cannot be undone.{/ts}</div> | |
48 | {else} | |
49 | <tr><td class="label">{$form.subject.label}</td><td>{$form.subject.html}</td></tr> | |
50 | <tr><td class="label"> </td><td class="description">{ts}Enter the case subject{/ts}</td></tr> | |
51 | <tr><td class="label">{$form.status_id.label}</td><td>{$form.status_id.html}</td></tr> | |
52 | <tr><td class="label"> </td><td class="description">{ts}Select the status for this case{/ts}</td></tr> | |
53 | ||
54 | <tr> | |
55 | {if $action neq 4 and $search eq false} | |
56 | <td class="label">{ts}Add To {/ts}</td><td class="view-value">{$currentlyViewedContact}</td></tr> | |
57 | <tr> | |
58 | <td class="label">{ts}Add More {/ts}</td> | |
59 | <td> | |
60 | <span id="case_contact_1"></span> | |
61 | {edit}<span class="description">{ts}You can optionally add this case to someone. Added case will appear in their Contact Dashboard.{/ts}</span>{/edit} | |
62 | </td> | |
63 | {else} | |
64 | <td class="label">{ts}Add To {/ts}</td><td class="view-value">{$caseContacts}</td> | |
65 | {/if} | |
66 | </tr> | |
67 | <tr><td class="label">{$form.case_type_id.label}</td><td>{$form.case_type_id.html}</td></tr> | |
68 | <tr><td class="label"> </td><td class="description">{ts}Select the appropriate type of the case {/ts}</td></tr> | |
69 | <tr><td class="label">{$form.start_date.label}</td><td>{$form.start_date.html} | |
70 | {include file="CRM/common/calendar/desc.tpl" trigger=trigger_case_1} | |
71 | {include file="CRM/common/calendar/body.tpl" dateVar=start_date offset=10 trigger=trigger_case_1} | |
72 | </td> | |
73 | </tr> | |
74 | <tr><td class="label">{$form.end_date.label}</td><td>{$form.end_date.html} | |
75 | {include file="CRM/common/calendar/desc.tpl" trigger=trigger_case_2} | |
76 | {include file="CRM/common/calendar/body.tpl" dateVar=end_date offset=10 trigger=trigger_case_2} | |
77 | </td> | |
78 | </tr> | |
79 | <tr><td class="label">{$form.details.label}</td><td>{$form.details.html}</td></tr> | |
80 | {/if} | |
81 | <tr> {* <tr> for add / edit form buttons *} | |
82 | <td> </td><td>{$form.buttons.html}</td> | |
83 | </tr> | |
84 | </table> | |
85 | </div> | |
86 | </fieldset> | |
87 | ||
88 | {* Build add contact *} | |
89 | {literal} | |
90 | <script type="text/javascript"> | |
91 | {/literal} | |
92 | {if $action neq 4 } | |
93 | {literal} | |
94 | buildContact( 1, 'case_contact' ); | |
95 | {/literal} | |
96 | {/if} | |
97 | {literal} | |
98 | ||
99 | var caseContactCount = {/literal}"{$caseContactCount}"{literal} | |
100 | ||
101 | if ( caseContactCount ) { | |
102 | for ( var i = 1; i <= caseContactCount; i++ ) { | |
103 | buildContact( i, 'case_contact' ); | |
104 | } | |
105 | } | |
106 | ||
107 | function buildContact( count, pref ) | |
108 | { | |
109 | if ( count > 1 ) { | |
110 | prevCount = count - 1; | |
111 | {/literal} | |
112 | {if $action eq 1 OR $action eq 2} | |
113 | {literal} | |
114 | cj('#' + pref + '_' + prevCount + '_show').hide(); | |
115 | {/literal} | |
116 | {/if} | |
117 | {literal} | |
118 | } | |
119 | ||
120 | var dataUrl = {/literal}"{crmURL h=0 q='snippet=4&count='}"{literal} + count + '&' + pref + '=1'; | |
121 | ||
122 | var result = dojo.xhrGet({ | |
123 | url: dataUrl, | |
124 | handleAs: "text", | |
125 | sync: true, | |
126 | timeout: 5000, //Time in milliseconds | |
127 | handle: function(response, ioArgs) { | |
128 | if (response instanceof Error) { | |
129 | if (response.dojoType == "cancel") { | |
130 | //The request was canceled by some other JavaScript code. | |
131 | console.debug("Request canceled."); | |
132 | } else if (response.dojoType == "timeout") { | |
133 | //The request took over 5 seconds to complete. | |
134 | console.debug("Request timed out."); | |
135 | } else { | |
136 | //Some other error happened. | |
137 | console.error(response); | |
138 | } | |
139 | } else { | |
140 | // on success | |
141 | dojo.byId( pref + '_' + count).innerHTML = response; | |
142 | dojo.parser.parse( pref + '_' + count ); | |
143 | } | |
144 | } | |
145 | }); | |
146 | } | |
147 | </script> | |
148 | ||
149 | {/literal} | |
150 | {/if} |