Add readonly to manage custom fields

merge-requests/28/head
Mike Koch 8 years ago
parent f2774badf1
commit 4c55e50c04

@ -179,8 +179,9 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<option value="checkbox" <?php if ($type == 'checkbox') {echo 'selected';} ?> ><?php echo $hesklang['scb']; ?></option>
<option value="date" <?php if ($type == 'date') {echo 'selected';} ?> ><?php echo $hesklang['date']; ?></option>
<option value="email" <?php if ($type == 'email') {echo 'selected';} ?> ><?php echo $hesklang['email']; ?></option>
<option value="readonly" <?php if ($type == 'readonly') {echo 'selected';} ?> ><?php echo $hesklang['readonly_custom_field']; ?></option>
<option value="hidden" <?php if ($type == 'hidden') {echo 'selected';} ?> ><?php echo $hesklang['sch']; ?></option>
</select>
</select><br>
<?php
$value = hesk_SESSION(array('new_cf','value'));
@ -190,7 +191,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
}
?>
<div id="text" style="display:<?php echo ($type == 'text') ? 'block;margin-top:10px' : 'none' ?>">
<div id="text" style="display:<?php echo ($type == 'text') ? 'block' : 'none' ?>">
<div class="form-group">
<label class="col-sm-3 control-label" for="max_length">
<?php echo $hesklang['custom_l']; ?>
@ -211,7 +212,20 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
</div>
</div>
<div id="textarea" style="display:<?php echo ($type == 'textarea') ? 'block;margin-top:10px' : 'none' ?>">
<div id="readonly" style="display:<?php echo ($type == 'readonly') ? 'block' : 'none' ?>">
<div class="form-group">
<label class="col-sm-3 control-label" for="value">
<?php echo $hesklang['value']; ?>
</label>
<div class="col-sm-3">
<input type="text" class="form-control" name="value"
value="<?php echo isset($value['value']) ? $value['value'] : ''; ?>" size="30">
</div>
</div>
</div>
<div id="textarea" style="display:<?php echo ($type == 'textarea') ? 'block' : 'none' ?>">
<div class="form-group">
<label class="col-sm-3 control-label" for="rows">
<?php echo $hesklang['rows']; ?>
@ -624,7 +638,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
}
function hesk_setType(myType) {
var divs = ["text", "textarea", "radio", "select", "checkbox", "date", "email", "hidden"];
var divs = ["text", "textarea", "radio", "select", "checkbox", "date", "email", "hidden", "readonly"];
var index;
var setTo;
@ -677,10 +691,6 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
</thead>
<tbody>
<?php
$i = 1;
$j = 1;
$k = 1;
$before = true;
$after = true;
$hide_up = false;
@ -749,18 +759,14 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<i class="fa fa-arrow-down fa-fw icon-link green" data-toggle="tooltip" title="<?php echo $hesklang['move_dn']; ?>"></i>
</a>
<?php
}
elseif ($k == $hesk_settings['num_custom_fields'] || $k == $num_before)
{
} elseif ($k == $hesk_settings['num_custom_fields'] || $k == $num_before) {
?>
<a href="custom_fields.php?a=order_cf&amp;id=<?php echo $id; ?>&amp;move=-15&amp;token=<?php hesk_token_echo(); ?>">
<i class="fa fa-arrow-up fa-fw icon-link green" data-toggle="tooltip" title="<?php echo $hesklang['move_up']; ?>"></i>
</a>
<i class="fa fa-fw icon-link">&nbsp;</i>
<?php
}
else
{
} else {
?>
<a href="custom_fields.php?a=order_cf&amp;id=<?php echo $id; ?>&amp;move=-15&amp;token=<?php hesk_token_echo(); ?>">
<i class="fa fa-arrow-up fa-fw icon-link green" data-toggle="tooltip" title="<?php echo $hesklang['move_up']; ?>"></i>
@ -1157,6 +1163,11 @@ function cf_validate()
$cf['value'] = array('max_length' => $cf['hidden_max_length'], 'default_value' => $cf['hidden_default_value']);
break;
case 'readonly':
$value = hesk_POST('value');
$cf['value'] = array('value' => $value);
break;
default:
$cf['type'] = 'text';
$cf['max_length'] = hesk_checkMinMax(intval(hesk_POST('max_length')), 1, 10000, 255);

@ -131,6 +131,8 @@ function hesk_custom_field_type($type)
return $hesklang['date'];
case 'hidden':
return $hesklang['sch'];
case 'readonly':
return $hesklang['readonly'];
default:
return false;
}

@ -67,6 +67,8 @@ $hesklang['record_this_token_warning'] = 'Please record this token, as this is t
$hesklang['all_tokens_revoked'] = 'All tokens for this user have been revoked';
$hesklang['staff_login_title'] = 'Staff Login';
$hesklang['manage_custom_fields'] = 'Manage Custom Fields';
$hesklang['value'] = 'Value';
$hesklang['readonly'] = 'Readonly';
// ADDED OR MODIFIED IN Mods for HESK 2.6.0
$hesklang['search_logs'] = 'Search Logs';

Loading…
Cancel
Save