From dcd051ff1f3b88d4067f1a4dcf45660e64065d7b Mon Sep 17 00:00:00 2001
From: Sashi20
Date: Wed, 27 Jan 2021 17:42:14 +0530
Subject: Update fields in proposal form, add guidelines page before code
submission
---
code.inc | 6 +++
general.inc | 120 +++++++++++++++++++++++++++++++++++++++++
manage_proposal.inc | 3 +-
proposal.inc | 7 ++-
xcos_textbook_companion.module | 54 +++++--------------
5 files changed, 145 insertions(+), 45 deletions(-)
diff --git a/code.inc b/code.inc
index 9459ad0..c14eab1 100755
--- a/code.inc
+++ b/code.inc
@@ -65,6 +65,11 @@ function upload_examples_form($form, &$form_state)
} //!$preference_data
/************************ end approve book details **************************/
/* add javascript for automatic book title, check if example uploaded, dependency selection effects */
+ if($preference_data->follow_guidelines == 0){
+ drupal_set_message(t('Please read the coding guidelines'), 'error');
+ drupal_goto('xcos-textbook-companion/code');
+ }
+ else{
$form['#attributes'] = array(
'enctype' => "multipart/form-data"
);
@@ -222,6 +227,7 @@ $form['book_details']['pref_id'] = array(
);
return $form;
}
+}
function upload_examples_form_validate($form, &$form_state)
{
if (!check_name($form_state['values']['name']))
diff --git a/general.inc b/general.inc
index 6cde464..9aaef8e 100755
--- a/general.inc
+++ b/general.inc
@@ -66,6 +66,7 @@ function list_chapters()
return;
} //!$preference_data
/************************ end approve book details **************************/
+ if($preference_data->follow_guidelines == 1){
$return_html = '';
$return_html .= 'Title of the Book:
' . $preference_data->book . '
';
$return_html .= 'Contributor Name:
' . $proposal_data->full_name . '
';
@@ -113,6 +114,13 @@ function list_chapters()
));
$submited_all_example = drupal_get_form("all_example_submitted_check_form",$preference_data->id);
$return_html .= drupal_render($submited_all_example);
+ }
+ else{
+ drupal_goto('xcos-textbook-companion/follow-guidelines/' . $preference_data->id);
+ /*$return_html = '';
+ $follow_guidelines = drupal_get_form("follow_guidelines_form",$preference_data->id);
+ $return_html .= drupal_render($follow_guidelines);*/
+ }
return $return_html;
}
function list_examples()
@@ -368,4 +376,116 @@ db_query('UPDATE xcos_textbook_companion_preference SET submited_all_examples_co
if (!drupal_mail('xcos_textbook_companion', 'all_code_submitted', $email_to, language_default(), $param, $from, TRUE))
drupal_set_message('Error sending email message.', 'error');
}
+}
+
+function follow_guidelines_form($form,&$form_state)
+{
+ $preference_id = arg(2);
+ $form = array();
+ $form['coding_guidelines'] = array(
+ '#type' => 'item',
+ '#markup' => t('
All the guidelines should be followed without fail for timely acceptance of code. Failure to do so might result in rejection of your work.
+ +Visit this page and click on your proposed Scilab TBC. You will now get an option to download the Scilab code for the chosen TBC.
+System Requirement
+ +You have to use Scilab 6.1.0 and above for creating the Xcos examples.
+You may use a different version of Scilab for executing the Scilab TBC code, if required.
+You may use a Windows/Linux/Mac OS
+If the 3rd solved problem from chapter 1 is to be represented (Example 1.3), then your file must be named as Ex1_3.xcos.
+Dependency files
+ +Use .sce extension for writing code while setting up the parameters for an Xcos diagram.
+Use .sci extension for writing code for user defined functions.
+These dependencies (if any) must be mentioned in a textbox clearly in the Xcos diagram.
+Do not include problem statements/text from the book in the diagram.
+Plotting
+ +All the plots must have appropriate labels on its axes.
+If a single plot contains several graphs then a legend must be added to help differentiate between different plots.
+The symbols used in the code should be the same as those being used in the textbook. If you are unable to write a symbol, you can write the name of the symbol in words. For example, "θ" can be written as "theta".
+Check that you are using the correct formula while using in-built functions (For example, the angles must be converted to degree (or radians) before calculating the sine or cosine etc).
+Label the input/output blocks and superblocks (if applicable) used in Xcos diagram using a textbox.
+Label the numeric output blocks that display the results, with proper units.
+If the textbook contains errors in calculations/results, mention the same in the block diagram itself by using the textbox.
+ +If the degree of error is less than +/- 2 then "The answers vary due to round off error" must be mentioned
+If the degree of error is more than +/- 2 then "The answer provided in the textbook is wrong" must be mentioned.
+