return;
}
+ $config = CRM_Core_Config::singleton();
+ $resources = CRM_Core_Resources::singleton();
+ $resources->addSetting(
+ array(
+ 'kcfinderPath' => $config->userFrameworkResourceURL .'packages' .DIRECTORY_SEPARATOR
+ )
+ );
+ $resources->addScriptFile('civicrm', 'templates/CRM/Badge/Form/Layout.js');
+
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_PrintLabel', 'title'), true);
unset($textAlignment['J']);
$this->add('select', "barcode_alignment", ts('Alignment'), $textAlignment);
+ $attributes = array(
+ 'readonly'=> true,
+ 'value' => ts('click here and select a file double clicking on it'),
+ );
+ $this->add('text', 'image_1', ts('Image 1'), $attributes + CRM_Core_DAO::getAttribute('CRM_Core_DAO_PrintLabel', 'title'));
+ $this->add('text', 'image_2', ts('Image 2'), $attributes + CRM_Core_DAO::getAttribute('CRM_Core_DAO_PrintLabel', 'title'));
+
$this->add('checkbox', 'is_default', ts('Default?'));
$this->add('checkbox', 'is_active', ts('Enabled?'));
$this->add('checkbox', 'is_reserved', ts('Reserved?'));
$defaults['add_barcode'] = CRM_Utils_Array::value('add_barcode', $data);
$defaults['barcode_alignment'] = CRM_Utils_Array::value('barcode_alignment', $data);
+ $defaults['image_1'] = CRM_Utils_Array::value('image_1', $data);
+ $defaults['image_2'] = CRM_Utils_Array::value('image_2', $data);
+
if ($this->_action == CRM_Core_Action::DELETE && isset($defaults['title'])) {
$this->assign('delName', $defaults['title']);
}
--- /dev/null
+// http://civicrm.org/licensing
+cj(function ($) {
+ function openKCFinder(field) {
+ window.KCFinder = {
+ callBack: function(url) {
+ field.val(url);
+ window.KCFinder = null;
+ }
+ };
+
+ window.open(CRM.kcfinderPath + 'kcfinder/browse.php?cms=civicrm&type=images', 'kcfinder_textbox',
+ 'status=0, toolbar=0, location=0, menubar=0, directories=0, ' +
+ 'resizable=1, scrollbars=0, width=800, height=600'
+ );
+ }
+
+ $('input[id^="image_"]').click(function(){
+ openKCFinder($(this));
+ });
+});
</td>
</tr>
+ <tr class="crm-badge-layout-form-block-image_1">
+ <td class="label">{$form.image_1.label}</td>
+ <td>{$form.image_1.html}<br/><span class="description">{ts}This image will displayed on top left{/ts}</span></td>
+ </tr>
+ <tr class="crm-badge-layout-form-block-image_2">
+ <td class="label">{$form.image_2.label}</td>
+ <td>{$form.image_2.html}<br/><span class="description">{ts}This image will displayed on top right{/ts}</span></td>
+ </tr>
<tr class="crm-badge-layout-form-block-add_barcode">
<td class="label">{$form.add_barcode.label}</td>
<td>{$form.add_barcode.html} {ts}on{/ts} {$form.barcode_alignment.html}</td>