Browse Source

#324 Add readonly and hidden custom fields

merge-requests/2/head
Mike Koch 6 years ago
parent
commit
8e5a23781f
  1. 3
      admin/admin_settings.php
  2. 2
      admin/admin_settings_save.php
  3. 38
      admin/options.php
  4. 5
      language/en/text.php

3
admin/admin_settings.php

@ -1529,7 +1529,6 @@ if ( defined('HESK_DEMO') )
<?php
for ($i=1;$i<=20;$i++)
{
//$this_field='custom' . $i;
$this_field = $hesk_settings['custom_fields']['custom'.$i];
$onload_locally = $this_field['use'] ? '' : ' disabled="disabled" ';
@ -1547,6 +1546,8 @@ if ( defined('HESK_DEMO') )
<option value="date" '.($this_field['type'] == 'date' ? 'selected="selected"' : '').'>'.$hesklang['date_custom_field'].'</option>
<option value="multiselect" '.($this_field['type'] == 'multiselect' ? 'selected="selected"' : '').'>'.$hesklang['multiple_select_custom_field'].'</option>
<option value="email" '.($this_field['type'] == 'email' ? 'selected="selected"' : '').'>'.$hesklang['email_custom_field'].'</option>
<option value="hidden" '.($this_field['type'] == 'hidden' ? 'selected="selected"' : '').'>'.$hesklang['hidden_custom_field'].'</option>
<option value="readonly" '.($this_field['type'] == 'readonly' ? 'selected="selected"' : '').'>'.$hesklang['readonly_custom_field'].'</option>
</select>
</td>
<td><div class="checkbox"><label><input type="checkbox" name="s_custom'.$i.'_req" value="1" id="s_custom'.$i.'_req" '; if ($this_field['req']) {echo 'checked="checked"';} echo $onload_locally.' /> '.$hesklang['yes'].'</label></div></td>

2
admin/admin_settings_save.php

@ -490,7 +490,7 @@ for ($i=1;$i<=20;$i++)
$set['custom_fields'][$this_field]['value'] = 'cc';
}
if (!in_array($set['custom_fields'][$this_field]['type'],array('text','textarea','select','radio','checkbox','date','multiselect','email')))
if (!in_array($set['custom_fields'][$this_field]['type'],array('text','textarea','select','radio','checkbox','date','multiselect','email','hidden','readonly')))
{
$set['custom_fields'][$this_field]['type'] = 'text';
}

38
admin/options.php

@ -120,6 +120,44 @@ switch ($type)
<p><input type="button" value=" '.$hesklang['ok'].' " onclick="Javascript:hesk_saveOptions()" /></p>
';
break;
case 'hidden':
echo '
<script language="javascript">
function hesk_saveOptions()
{
window.opener.document.getElementById(\'s_'.$id.'_val\').value = document.getElementById(\'o1\').value;
window.close();
}
</script>
<p>'.$hesklang['hidden_custom_field_help'].'</p>
<table border="0">
<tr>
<td>'.$hesklang['value_colon'].'<td>
<td><input type="text" name="o1" id="o1" value="'.$query.'" size="30" /></td>
</tr>
</table>
<p><input type="button" value=" '.$hesklang['ok'].' " onclick="Javascript:hesk_saveOptions()" /></p>
';
break;
case 'readonly':
echo '
<script language="javascript">
function hesk_saveOptions()
{
window.opener.document.getElementById(\'s_'.$id.'_val\').value = document.getElementById(\'o1\').value;
window.close();
}
</script>
<p>'.$hesklang['readonly_custom_field_help'].'</p>
<table border="0">
<tr>
<td>'.$hesklang['value_colon'].'<td>
<td><input type="text" name="o1" id="o1" value="'.$query.'" size="30" /></td>
</tr>
</table>
<p><input type="button" value=" '.$hesklang['ok'].' " onclick="Javascript:hesk_saveOptions()" /></p>
';
break;
case 'textarea':
if (strpos($query,'#') !== false)
{

5
language/en/text.php

@ -31,6 +31,11 @@ $hesklang['screen_resolution'] = 'Screen Resolution';
$hesklang['display_user_agent_information'] = 'Show user agent';
$hesklang['display_user_agent_information_help'] = 'When enabled, staff will be able to view the operating system, browser,
and screen resolution of the device used to create the ticket.';
$hesklang['value_colon'] = 'Value:';
$hesklang['hidden_custom_field'] = 'Hidden text field';
$hesklang['hidden_custom_field_help'] = 'This input is the same as a text field; however this value cannot be changed and will not be visible to the user.';
$hesklang['readonly_custom_field'] = 'Read-only text field';
$hesklang['readonly_custom_field_help'] = 'This input is the same as a text field; however this value cannot be changed, but will be visible to the user.';
// ADDED OR MODIFIED IN Mods for HESK 2.4.0
$hesklang['sort_by_user_defined_order'] = 'Sort by user-defined order';

Loading…
Cancel
Save