Merge remote-tracking branch 'upstream/4.3' into 4.3-master-2013-07-23-17-12-38
[civicrm-core.git] / templates / CRM / Member / Form / MembershipBlock.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.3 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
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{* Configure Membership signup/renewal block for an Online Contribution page *}
27<div id="form" class="crm-block crm-form-block crm-member-membershipblock-form-block">
28{if $isQuick}
29 <div id="memPopupContainer">
30 {ts}Once you switch to using a Price Set, you won't be able to switch back to your existing settings below except by re-entering them. Are you sure you want to switch to a Price Set?{/ts}
31 </div>
32{/if}
33<div id="help">
34 {ts}Use this form to enable and configure a Membership Signup and Renewal section for this Online Contribution Page. If you're not using this page for membership signup, leave the <strong>Enabled</strong> box un-checked..{/ts} {docURL page="user/membership/setup"}
35</div>
36 {if $form.membership_type.html}
37 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
38 <table class="form-layout-compressed">
39 <tr class="crm-member-membershipblock-form-block-member_is_active">
40 <td class="label"></td><td class="html-adjust">{$form.member_is_active.html}&nbsp;{$form.member_is_active.label}<br />
41 <span class="description">{ts}Include a Membership Signup section in this Online Contribution page?{/ts}</span></td>
42 </tr>
43 </table>
44 <div id="memberFields">
45 <table class="form-layout-compressed">
46 <tr class="crm-member-membershipblock-form-block-new_title">
47 <td class="label">{$form.new_title.label}
48 {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_block' field='new_title' id=$membershipBlockId}{/if}</td><td>{$form.new_title.html}<br />
49 <span class="description">{ts}Membership section title - for new member signups.{/ts}</span></td>
50 </tr>
51 <tr class="crm-member-membershipblock-form-block-new_text">
52 <td class="label">{$form.new_text.label}</td>
53 <td>{$form.new_text.html}<br />
54 <span class="description">{ts}Membership section introductory text - for new member signups.{/ts}<br /></span><br /></td>
55 </tr>
56 <tr class="crm-member-membershipblock-form-block-renewal_title">
57 <td class="label">{$form.renewal_title.label}
58 {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_block' field='renewal_title' id=$membershipBlockId}{/if}</td><td>{$form.renewal_title.html}<br />
59 <span class="description">{ts}Membership section title - displayed to renewing members.{/ts}</span></td>
60 </tr>
61 <tr class="crm-member-membershipblock-form-block-renewal_text">
62 <td class="label">{$form.renewal_text.label}</td>
63 <td>{$form.renewal_text.html}<br />
64 <span class="description">{ts}Membership section introductory text - displayed to renewing members.{/ts}</span><br /></td>
65 </tr>
66 <tr class="crm-member-membershipblock-form-block-member_price_set_id">
67 <td class="label">{$form.member_price_set_id.label}</td>
68 <td>
69 {if $price eq false}
70 {capture assign=adminPriceSetsURL}{crmURL p="civicrm/admin/price" q="reset=1"}{/capture}
71 <div class="status message">{ts 1=$adminPriceSetsURL}No Membership Price Sets have been configured / enabled for your site. Price sets allow you to configure more complex membership signup and renewal options, including allowing constituents to sign up for multiple memberships at the same time. Click <a href='%1'>here</a> if you want to configure price sets for your site.{/ts}</div>
72 {else}
73 {$form.member_price_set_id.html}
74 {/if}
75 </td>
76 </tr>
77 {if $isQuick}
78 <tr id="quickConfigConvertMessage">
79 <td></td>
247506c6 80 <td><div class="status message">{ts}Click <a id='memQuickconfig' href='#'>here</a> if you want to configure the Membership Types below as part of a Price Set, with the added flexibility and complexity that entails.{/ts}</div></td>
6a488035
TO
81 </tr>
82 {/if}
83 <tr id="membership_type-block" class="crm-member-membershipblock-form-block-membership_type">
84 <td class="label">{$form.membership_type.label}</td>
85 <td>
86 {assign var="count" value="1"}
87 {strip}
88 <table class="report">
89 <tr class="columnheader" style="vertical-align:top;"><th style="border-right: 1px solid #4E82CF;">{ts}Include these membership types{/ts}</th><th{if $is_recur} style="border-right: 1px solid #4E82CF;"{/if}>{ts}Default{/ts}<br />
90 <span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('membership_type_default', 'MembershipBlock'); return false;" >unselect</a>)</span></th>{if $is_recur}<th>{ts}Auto-renew{/ts}</th>{/if}</tr>
91 {assign var="index" value="1"}
92 {foreach name=outer key=key item=item from=$form.membership_type}
93 {if $index < 10}
94 {assign var="index" value=`$index+1`}
95 {else}
96 <tr>
97 <td class="labels font-light">{$form.membership_type.$key.html}</td>
98 <td class="labels font-light">{$form.membership_type_default.$key.html}</td>
99 {if $is_recur}
100 <td class="labels font-light">
101 {if $auto_renew.$key}
102 {assign var="element" value="auto_renew"|cat:_|cat:$key}{$form.$element.html}
103 {else}
104 {ts}(Not Available){/ts}
105 {/if}
106 </td>
107 {/if}
108 </tr>
109 {/if}
110 {/foreach}
111 </table>
112 {/strip}
113 </td>
114 </tr>
115 <tr id="requiredSignup" class="crm-member-membershipblock-form-block-is_required">
116 <td class="label"></td><td class="html-adjust">{$form.is_required.html}&nbsp;{$form.is_required.label}<br />
117 <span class="description">{ts}If checked, user must signup for one of the displayed membership options before continuing.{/ts}</span></td>
118 </tr>
119 <tr id="separatePayment" class="crm-member-membershipblock-form-block-is_separate_payment">
120 <td class="label"></td><td class="html-adjust">{$form.is_separate_payment.html}&nbsp;{$form.is_separate_payment.label} {help id="id-separate-pay"}<br />
121 <span class="description">{ts}Check this box if you are including both Membership Signup/Renewal AND a Contribution Amount section, AND you want the membership fee to be charged separately from any additional contribution amount.{/ts}</span></td>
122 </tr>
123 <tr id="displayFee" class="crm-member-membershipblock-form-block-display_min_fee">
124 <td class="label"></td><td class="html-adjust">{$form.display_min_fee.html}&nbsp;{$form.display_min_fee.label} {help id="id-display-fee"}<br />
125 <span class="description">{ts}Display the membership fee along with the membership name and description for each membership option?{/ts}</span></td>
126 </tr>
127
128 </table>
129 </div>
130 {else}
131 <div class="status message">
132 {capture assign=linkURL}{crmURL p="civicrm/admin/member/membershipType" q="reset=1"}{/capture}
133 {ts 1=$linkURL}You need to have at least one <a href="%1">Membership Type</a> with 'Public' visibility in order to enable self-service Membership Signup and Renewal.{/ts}
134 </div>
135 {/if}
136 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
137</div>
138
139{literal}
140<script type="text/javascript">
141 cj( function() {
142 //show/hide membership block
143 showHideMembershipBlock();
144 cj('#member_is_active').click( function() {
145 showHideMembershipBlock();
146 });
147
148 //show/ hide blocks if price set is selected
149 checkIfPriceSetIsSelected( );
150 cj('#member_price_set_id').change( function(){
151 checkIfPriceSetIsSelected( );
152 });
153 });
154
155 // function to show/hide membership block fields
156 function showHideMembershipBlock( ) {
157 if ( cj('#member_is_active').attr('checked') ) {
158 cj('#memberFields').show();
159 } else {
160 cj('#memberFields').hide();
161 }
162 }
163 // function to handle show/hide of membership type and related blocks if price set is selected
164 function checkIfPriceSetIsSelected( ) {
165 if ( cj('#member_price_set_id').val() ) {
166 cj('#membership_type-block').hide();
167 cj('#requiredSignup').hide();
168 cj('#displayFee').hide();
169 cj('#separatePayment').hide();
170 cj('#quickConfigConvertMessage').hide();
171 } else {
172 cj('#membership_type-block').show();
173 cj('#requiredSignup').show();
174 cj('#displayFee').show();
175 cj('#separatePayment').show();
176 }
177 }
178</script>
179{/literal}
180
181{* include jscript to warn if unsaved form field changes *}
182{include file="CRM/common/formNavigate.tpl"}
183{if $isQuick}
184{literal}
185<script type="text/javascript">
186cj( document ).ready( function( ) {
187 cj("#memPopupContainer").hide();
188});
189cj("#memQuickconfig").click(function(){
190 cj("#memPopupContainer").dialog({
191 title: "Selected Price Set",
192 width:400,
193 height:220,
194 modal: true,
195 overlay: {
196 opacity: 0.5,
197 background: "black"
198 },
199 buttons: {
200 "Ok": function() {
201 var dataUrl = {/literal}'{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Core_Page_AJAX&fnName=setIsQuickConfig&context=civicrm_contribution_page&id=$contributionPageID" }';
202 var redirectUrl = '{crmURL p="civicrm/admin/price/field" h=0 q="reset=1&action=browse&sid=" }'; {literal}
203
204 cj.ajax({
205 url: dataUrl,
206 async: false,
207 global: false,
208 success: function ( result ) {
209 if (result) {
210 window.location= redirectUrl+eval(result);
211 }
212 }
213 });
214 },
215 "Close": function() {
216 cj(this).dialog("close");
217 }
218 }
219 });
220return false;
221});
222</script>
223{/literal}
224{/if}