gruffen commited on 2011-04-02 16:19:23
Showing 5 changed files, with 25 additions and 7 deletions.
... | ... |
@@ -304,7 +304,7 @@ $txt['shd_admin_default_state_off'] = 'Not checked'; |
304 | 304 |
$txt['shd_admin_save_custom_field'] = 'Save field'; |
305 | 305 |
$txt['shd_admin_delete_custom_field'] = 'Delete field'; |
306 | 306 |
$txt['shd_admin_cancel_custom_field'] = 'Cancel'; |
307 |
-$txt['shd_admin_delete_custom_field_confirm'] = 'Do you really want to delete this custom field?'; |
|
307 |
+$txt['shd_admin_delete_custom_field_confirm'] = 'Do you really want to delete this custom field? All values stored for this field will be removed, and there is NO undo function.'; |
|
308 | 308 |
$txt['shd_admin_custom_field_options'] = 'Options'; |
309 | 309 |
$txt['shd_admin_custom_field_options_desc'] = 'Leave option box blank to remove. Radio button selects default option.'; |
310 | 310 |
$txt['shd_admin_custom_field_no_selected_default'] = 'No selected default'; |
... | ... |
@@ -197,8 +197,9 @@ function shd_admin_custom_save() |
197 | 197 |
checkSession('request'); |
198 | 198 |
|
199 | 199 |
// Deletifyingistuffithingi? |
200 |
- if (isset($_REQUEST['delete'])) |
|
200 |
+ if (isset($_REQUEST['delete']) && !empty($_REQUEST['field'])) |
|
201 | 201 |
{ |
202 |
+ $_REQUEST['field'] = (int) $_REQUEST['field']; |
|
202 | 203 |
$smcFunc['db_query']('', ' |
203 | 204 |
DELETE FROM {db_prefix}helpdesk_custom_fields |
204 | 205 |
WHERE id_field = {int:field}', |
... | ... |
@@ -207,6 +208,14 @@ function shd_admin_custom_save() |
207 | 208 |
) |
208 | 209 |
); |
209 | 210 |
|
211 |
+ $smcFunc['db_query']('', ' |
|
212 |
+ DELETE FROM {db_prefix}helpdesk_custom_fields_values |
|
213 |
+ WHERE id_field = {int:field}', |
|
214 |
+ array( |
|
215 |
+ 'field' => $_REQUEST['field'], |
|
216 |
+ ) |
|
217 |
+ ); |
|
218 |
+ |
|
210 | 219 |
// End of the road |
211 | 220 |
redirectexit('action=admin;area=helpdesk_customfield;' . $context['session_var'] . '=' . $context['session_id']); |
212 | 221 |
} |
... | ... |
@@ -75,8 +75,8 @@ function template_shd_custom_field_home() |
75 | 75 |
<td>', empty($field['is_first']) ? ('<a href="' . $scripturl . '?action=admin;area=helpdesk_customfield;sa=move;field=' . $field['id_field'] . ';direction=up;' . $context['session_var'] . '=' . $context['session_id'] . '"><img src="' . $settings['default_images_url'] . '/simpledesk/move_up.png" alt="' . $txt['shd_admin_move_up'] . '" title="' . $txt['shd_admin_move_up'] . '" /></a>') : '', '</td> |
76 | 76 |
<td>', empty($field['is_last']) ? ('<a href="' . $scripturl . '?action=admin;area=helpdesk_customfield;sa=move;field=' . $field['id_field'] . ';direction=down;' . $context['session_var'] . '=' . $context['session_id'] . '"><img src="' . $settings['default_images_url'] . '/simpledesk/move_down.png" alt="' . $txt['shd_admin_move_down'] . '" title="' . $txt['shd_admin_move_down'] . '" /></a>') : '', '</td> |
77 | 77 |
<td> |
78 |
- <a href="', $scripturl, '?action=admin;area=helpdesk_customfield;sa=edit;field=', $field['id_field'], ';', $context['session_var'], ';', $context['session_id'], '"><img src="', $settings['default_images_url'], '/simpledesk/edit.png" class="icon" alt="', $txt['shd_ticket_edit'],'" /></a> |
|
79 |
- <a href="', $scripturl, '?action=admin;area=helpdesk_customfield;sa=save;field=', $field['id_field'], ';delete;', $context['session_var'], ';', $context['session_id'], '"><img src="', $settings['default_images_url'], '/simpledesk/delete.png" class="icon" alt="', $txt['shd_ticket_delete'],'" /></a> |
|
78 |
+ <a href="', $scripturl, '?action=admin;area=helpdesk_customfield;sa=edit;field=', $field['id_field'], ';', $context['session_var'], '=', $context['session_id'], '"><img src="', $settings['default_images_url'], '/simpledesk/edit.png" class="icon" alt="', $txt['shd_ticket_edit'],'" /></a> |
|
79 |
+ <a href="', $scripturl, '?action=admin;area=helpdesk_customfield;sa=save;field=', $field['id_field'], ';delete;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(' . JavaScriptEscape($txt['shd_admin_delete_custom_field_confirm']). ');"><img src="', $settings['default_images_url'], '/simpledesk/delete.png" class="icon" alt="', $txt['shd_ticket_delete'],'" /></a> |
|
80 | 80 |
</td> |
81 | 81 |
</tr>'; |
82 | 82 |
|
... | ... |
@@ -178,7 +178,7 @@ function template_ticket_custom_fields() |
178 | 178 |
if ($field['type'] == CFIELD_TYPE_TEXT) |
179 | 179 |
{ |
180 | 180 |
echo ' |
181 |
- <dd><input type="text" name="field-', $field['id'], '" value="', $field['value'], '" size="50" /></dd>'; |
|
181 |
+ <dd><input type="text" name="field-', $field['id'], '" value="', $field['value'], '" class="input_text" /></dd>'; |
|
182 | 182 |
} |
183 | 183 |
// Textarea |
184 | 184 |
elseif ($field['type'] == CFIELD_TYPE_LARGETEXT) |
... | ... |
@@ -226,13 +226,18 @@ function template_ticket_custom_fields() |
226 | 226 |
// Last one, radio buttons |
227 | 227 |
elseif ($field['type'] == CFIELD_TYPE_RADIO) |
228 | 228 |
{ |
229 |
+ echo ' |
|
230 |
+ <dd>'; |
|
229 | 231 |
if (empty($field['is_required'])) |
230 | 232 |
echo ' |
231 |
- <dd><input name="field-', $field['id'], '" type="radio" value="0"', $field['value'] == 0 ? ' checked="checked"' : '', ' /> <span>', $txt['shd_no_value'], '</span></dd>'; |
|
233 |
+ <input name="field-', $field['id'], '" type="radio" value="0"', $field['value'] == 0 ? ' checked="checked"' : '', ' /> <span>', $txt['shd_no_value'], '</span><br />'; |
|
232 | 234 |
|
233 | 235 |
foreach ($field['options'] as $key => $option) |
234 | 236 |
echo ' |
235 |
- <dd><input name="field-', $field['id'], '" type="radio" value="', $key, '"', $field['value'] == $key ? ' checked="checked"' : '', ' /> <span>', $option, '</span></dd>'; |
|
237 |
+ <input name="field-', $field['id'], '" type="radio" value="', $key, '"', $field['value'] == $key ? ' checked="checked"' : '', ' /> <span>', $option, '</span><br />'; |
|
238 |
+ |
|
239 |
+ echo ' |
|
240 |
+ </dd>'; |
|
236 | 241 |
} |
237 | 242 |
// Default to a text input field |
238 | 243 |
else |
239 | 244 |