Implement config templates
This commit is contained in:
@@ -166,6 +166,11 @@ $config['programs/edit'] = array(
|
||||
'label' => _('Name of the program'),
|
||||
'rules' => 'required|max_length[100]|trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'config_template',
|
||||
'label' => _('Config template'),
|
||||
'rules' => 'required',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,7 +60,11 @@ class Programs extends Admin_Controller {
|
||||
}
|
||||
|
||||
if ($this->form_validation->run('programs/edit') === true) {
|
||||
if ($this->program->update($this->input->post('name'), $id)) {
|
||||
$data = array(
|
||||
'name' => $this->input->post('name'),
|
||||
'config_template' => $_POST['config_template'],
|
||||
);
|
||||
if ($this->program->update($data, $id)) {
|
||||
$this->messages->add(sprintf(_("The program '%s' has been updated successfully"), $this->input->post('name')), 'success');
|
||||
redirect('admin/programs', 303);
|
||||
}
|
||||
|
||||
@@ -32,16 +32,16 @@ $(document).ready(function() {
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<?=form_label(_('Config file line'), 'input_line');?>
|
||||
<?=form_label(_('Config template'), 'config_template');?>
|
||||
<span class="req">*</span>
|
||||
<div>
|
||||
<textarea name="input_line" id="input_line" rows="6" cols="60" class="textarea"><?=set_value('input_line', $program['input_line']);?></textarea>
|
||||
<?=form_error('input_line')?>
|
||||
<textarea name="config_template" id="config_template" rows="6" cols="60" class="textarea"><?=set_value('config_template', $program['config_template']);?></textarea>
|
||||
<?=form_error('config_template')?>
|
||||
</div>
|
||||
<label class="note">
|
||||
<?=_('Here you can specify how a single line of a configuration file looks. You can use the following placeholders:');?><br />
|
||||
<strong>{type}</strong> <?=_('Parameter type');?><br />
|
||||
<strong>{param}</strong> <?=_('Parameter name');?><br />
|
||||
<?=_('Here you can specify how the configuration file looks. You can use the following placeholders:');?><br />
|
||||
<strong>{parameters}{/parameters}</strong> <?=_('Parameter loop');?><br />
|
||||
<strong>{name}</strong> <?=_('Parameter name');?><br />
|
||||
<strong>{value}</strong> <?=_('Value');?><br />
|
||||
</label>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user