From 33427d87ad7b8beca5c953c1b33c375cf4f7456a Mon Sep 17 00:00:00 2001
From: prashantsinalkar
Date: Tue, 23 Aug 2016 18:16:36 +0530
Subject: removed delete option
---
editcode.inc | 26 +++++++++++++++++++++-----
general.inc | 5 +++--
2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/editcode.inc b/editcode.inc
index 99c34ef..653fcf3 100755
--- a/editcode.inc
+++ b/editcode.inc
@@ -216,16 +216,32 @@ function upload_examples_edit_form($form, $form_state)
'#title' => t('Existing Main or Source File'),
'#markup' => $source_file
);
- $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.'
+ $form['sourcefile']['source_file_action'] = array(
+ '#type' => 'radios',
+ '#options' => array('1'=>"Replace
", 2=>"Delete"),
+ '#title' => t('Select Action'),
+ '#required' => TRUE
);
$form['sourcefile']['sourcefile1'] = array(
'#type' => 'file',
'#title' => t('Upload New Main or Source File'),
'#size' => 48,
- '#description' => t("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.
") . t('Allowed file extensions : ') . variable_get('textbook_companion_source_extensions', '')
+ '#description' => t("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.
") . t('Allowed file extensions : ') . variable_get('textbook_companion_source_extensions', ''),
+ '#states' => array(
+ 'visible' => array(
+ ':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'),
+ ),
+ ),
);
$form['sourcefile']['cur_source_file_id'] = array(
'#type' => 'hidden',
diff --git a/general.inc b/general.inc
index 56e5828..792d9df 100755
--- a/general.inc
+++ b/general.inc
@@ -269,11 +269,12 @@ function list_examples()
$example_data->caption,
$approval_status,
$example_files,
- l('Edit', 'textbook_companion/code/edit/' . $example_data->id) . ' | ' . l('Delete', 'textbook_companion/code/delete/' . $example_data->id, array(
+ l('Edit', 'textbook_companion/code/edit/' . $example_data->id)
+ /*l('Edit', 'textbook_companion/code/edit/' . $example_data->id) . ' | ' . l('Delete', 'textbook_companion/code/delete/' . $example_data->id, array(
'attributes' => array(
'onClick' => 'return confirm("Are you sure you want to delete the example?")'
)
- ))
+ ))*/
),
'valign' => 'top'
);
--
cgit