{*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
<div class="crm-block crm-form-block crm-pdf-format-form-block">
<table class="form-layout-compressed">
<tr>
- <td class="label-left">{$form.format_id.label}</td><td>{$form.format_id.html}{help id="id-pdf-format" file="CRM/Contact/Form/Task/PDFLetterCommon.hlp"}</td>
- <td colspan="2"> </td>
- </tr>
+ <td class="label-left">{$form.format_id.label} {help id="id-pdf-format" file="CRM/Contact/Form/Task/PDFLetterCommon.hlp"}</td>
+ <td>{$form.format_id.html}</td>
+ </tr>
<tr>
<td class="label-left">{$form.paper_size.label}</td><td>{$form.paper_size.html}</td>
<td class="label-left">{$form.orientation.label}</td><td>{$form.orientation.html}</td>
<td class="label-left">{$form.margin_left.label}</td><td>{$form.margin_left.html}</td>
<td class="label-left">{$form.margin_right.label}</td><td>{$form.margin_right.html}</td>
</tr>
+ <tr>
+ <td class="label-left">{$form.stationery.label}</td><td>{$form.stationery.html}</td>
+ <td colspan="2"> </td>
+ </tr>
</table>
<div id="bindFormat">{$form.bind_format.html} {$form.bind_format.label}</div>
<div id="updateFormat" style="display: none">{$form.update_format.html} {$form.update_format.label}</div>
{literal}
<script type="text/javascript">
-cj(function() {
- cj().crmAccordions();
+CRM.$(function($) {
+ var $form = $('form.{/literal}{$form.formClass}{literal}');
+ $('#format_id', $form).on('change', function() {
+ selectFormat($(this).val());
+ });
});
var currentWidth;
if ( document.getElementById('template') == null || document.getElementById('template').value == '' ) {
templateExists = false;
}
- var formatExists = true;
- if ( document.getElementById('format_id').value == 0 ) {
- formatExists = false;
- }
+ var formatExists = !!cj('#format_id').val();
if ( templateExists && formatExists ) {
document.getElementById("bindFormat").style.display = "block";
} else if ( formatExists && document.getElementById("saveTemplate") != null && document.getElementById("saveTemplate").checked ) {
function showUpdateFormatChkBox()
{
- if ( document.getElementById('format_id').value != 0 ) {
- document.getElementById("updateFormat").style.display = "block";
+ if (cj('#format_id').val()) {
+ cj("#updateFormat").show();
}
}
-function hideUpdateFormatChkBox()
-{
- document.getElementById("update_format").checked = false;
- document.getElementById("updateFormat").style.display = "none";
+function updateFormatLabel() {
+ cj('.pdf-format-header-label').html(cj('#format_id option:selected').text() || cj('#format_id').attr('placeholder'));
}
+updateFormatLabel();
+
function selectFormat( val, bind )
{
- if ( val == null || val == 0 ) {
+ updateFormatLabel();
+ if (!val) {
val = 0;
bind = false;
}
cj("#margin_left").val( data.margin_left );
cj("#margin_right").val( data.margin_right );
selectPaper( data.paper_size );
- hideUpdateFormatChkBox();
+ cj("#update_format").prop({checked: false}).parent().hide();
document.getElementById('bind_format').checked = bind;
showBindFormatChkBox();
}, 'json');