summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xeditcode.inc33
1 files changed, 20 insertions, 13 deletions
diff --git a/editcode.inc b/editcode.inc
index 653fcf3..8cf51eb 100755
--- a/editcode.inc
+++ b/editcode.inc
@@ -218,7 +218,10 @@ function upload_examples_edit_form($form, $form_state)
);
$form['sourcefile']['source_file_action'] = array(
'#type' => 'radios',
- '#options' => array('1'=>"Replace<br>", 2=>"Delete"),
+ '#options' => array(
+ '1' => "Replace Existing Main or Source File<br>",
+ '2' => "Delete Existing Main or Source File"
+ ),
'#title' => t('Select Action'),
'#required' => TRUE
);
@@ -229,20 +232,24 @@ function upload_examples_edit_form($form, $form_state)
'#description' => t("<Strong style='color:red' >Upload new Main or Source file above, if you want to replace the existing file. Leave blank if you want to keep using the existing file.</strong> <br />") . t('Allowed file extensions : ') . variable_get('textbook_companion_source_extensions', ''),
'#states' => array(
'visible' => array(
- ':input[name="source_file_action"]' => array('value' => '1'),
- ),
- ),
+ ':input[name="source_file_action"]' => array(
+ 'value' => '1'
+ )
+ )
+ )
);
+ /*
$form['sourcefile']['cur_source_checkbox'] = array(
- '#type' => 'checkbox',
- '#title' => t('Delete Existing Main or Source File'),
- '#description' => 'Check to delete the existing Main or Source file.',
- '#states' => array(
- 'visible' => array(
- ':input[name="source_file_action"]' => array('value' => '2'),
- ),
- ),
+ '#type' => 'checkbox',
+ '#title' => t('Delete Existing Main or Source File'),
+ '#description' => 'Check to delete the existing Main or Source file.',
+ '#states' => array(
+ 'visible' => array(
+ ':input[name="source_file_action"]' => array('value' => '2'),
+ ),
+ ),
);
+ */
$form['sourcefile']['cur_source_file_id'] = array(
'#type' => 'hidden',
'#value' => $source_file_id
@@ -720,7 +727,7 @@ function upload_examples_edit_form_submit($form, &$form_state)
drupal_set_message("Error deleting example source file. File not present in database.", 'error');
return;
} //!$file_data
- if (($form_state['values']['cur_source_checkbox'] == 1) && (!$_FILES['files']['name']['sourcefile1']))
+ if (($form_state['values']['source_file_action'] == 2) && (!$_FILES['files']['name']['sourcefile1']))
{
if (!delete_file($cur_file_id))
{