Skip to content
Snippets Groups Projects
Commit d87c3006 authored by Kurund Jalmi's avatar Kurund Jalmi
Browse files

more work on form building, added images, CRM-12965

parent 012ee9a8
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,15 @@ class CRM_Badge_Form_Layout extends CRM_Admin_Form {
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);
......@@ -87,6 +96,13 @@ class CRM_Badge_Form_Layout extends CRM_Admin_Form {
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?'));
......@@ -119,6 +135,9 @@ class CRM_Badge_Form_Layout extends CRM_Admin_Form {
$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']);
}
......
// 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));
});
});
......@@ -75,6 +75,14 @@
</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}&nbsp;&nbsp;&nbsp;{ts}on{/ts}&nbsp;&nbsp;&nbsp;{$form.barcode_alignment.html}</td>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment