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.
+
+
+
+
+'),
+ );
+ $form['follow_guidelines'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('I have read the coding guidelines'),
+ // '#description' => 'Once you have submitted this option you are not able to upload more examples.',
+ '#required' => TRUE,
+ );
+ $form['hidden_preference_id'] = array(
+ '#type' => 'hidden',
+ '#value' => $preference_id
+ );
+ $form['submit'] = array(
+ '#type' => 'submit',
+ '#value' => t('Submit')
+ );
+ return $form;
+}
+
+function follow_guidelines_form_submit($form,&$form_state){
+global $user;
+if ($form_state['values']['follow_guidelines'] == 1) {
+db_query('UPDATE xcos_textbook_companion_preference SET follow_guidelines = 1 WHERE id = :preference_id',array(':preference_id' => $form_state['values']['hidden_preference_id']));
+}
+drupal_goto('xcos-textbook-companion/code');
}
\ No newline at end of file
diff --git a/manage_proposal.inc b/manage_proposal.inc
index 6151f64..446c25e 100755
--- a/manage_proposal.inc
+++ b/manage_proposal.inc
@@ -39,8 +39,7 @@ function _proposal_all()
function _tbc_ext($status, $preference_id)
{
if ($status == "Approved") {
- //return " | " . l("ER", "tbc_external_review/add_book/" . $preference_id);
- return "";
+ return " | " . l("ER", "xcos-tbc-external-review/add-book/" . $preference_id);
} else {
return "";
}
diff --git a/proposal.inc b/proposal.inc
index 7195c76..6e18442 100644
--- a/proposal.inc
+++ b/proposal.inc
@@ -340,7 +340,7 @@ function book_proposal_form($form, &$form_state)
//'#date_increment' => 0,
//'#minDate' => '+0',
//'#date_year_range' => '0 : +0',
- '#datepicker_options' => array('minDate' => 0),
+ '#datepicker_options' => array('maxDate' => 90, 'minDate' => 0),
'#required' => TRUE
);
$form['operating_system'] = array(
@@ -366,6 +366,11 @@ function book_proposal_form($form, &$form_state)
),
'#suffix' => '',
);
+ $form['terms_and_condition'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('I understand that I should refer to the Scilab Textbook Companion (PDF and code) to create the Xcos TBC. This is to ensure consistency in the example number, caption, variable names, axes labeling etc.'),
+ '#required' => TRUE
+ );
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit')
diff --git a/xcos_textbook_companion.module b/xcos_textbook_companion.module
index 3b0f4bf..e2254cd 100755
--- a/xcos_textbook_companion.module
+++ b/xcos_textbook_companion.module
@@ -285,6 +285,18 @@ function xcos_textbook_companion_menu()
),
'file' => 'general.inc'
);
+ $items['xcos-textbook-companion/follow-guidelines'] = array(
+ 'title' => 'Xcos Coding Guidelines',
+ 'description' => 'Xcos Coding Guidelines',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array(
+ 'follow_guidelines_form'
+ ),
+ 'access arguments' => array(
+ 'upload xcos code'
+ ),
+ 'file' => 'general.inc'
+ );
$items['xcos-textbook-companion/code/list_chapters'] = array(
'title' => 'List Chapters',
'description' => 'List Chapters',
@@ -736,36 +748,6 @@ function xcos_textbook_companion_menu()
),
'file' => 'cheque_contact.inc'
);
- $items['xcos-textbook-companion/certificate'] = array(
- 'title' => 'List Of All Certificates',
- 'description' => 'List Of All Certificates',
- 'page callback' => '_list_all_certificates',
- 'access arguments' => array(
- 'list all xcos certificates'
- ),
- 'file' => 'pdf/list_all_certificates.inc'
- );
- $items['xcos-textbook-companion/certificate/generate-pdf'] = array(
- 'title' => 'Download Certificate',
- 'description' => 'Download Certificate',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array(
- 'generate_pdf'
- ),
- 'access arguments' => array(
- 'generate pdf'
- ),
- 'file' => 'pdf/generate_pdf.inc'
- );
- $items["xcos-textbook-companion/certificates/verify"] = array(
- "title" => "Certificate Verification",
- "page callback" => "verify_certificates",
- "access arguments" => array(
- "verify xcos certificates"
- ),
- 'file' => 'pdf/verify_certificates.inc',
-
- );
$items['xcos-textbook-companion/manage-proposal/paper-submission'] = array(
'title' => 'Application Submission',
'description' => 'Application Submission',
@@ -860,18 +842,6 @@ function xcos_textbook_companion_permission()
"title" => t("Comment cheque"),
"description" => t("Comment cheque.")
),
- "list all xcos certificates" => array(
- "title" => t("list all xcos certificates"),
- "description" => t("Allows users to list all xcos certificates.")
- ),
- "verify xcos certificates" => array(
- "title" => t("Verify certificates"),
- "description" => t("Allows users to verify xcos certificates.")
- ),
- "generate pdf" => array(
- "title" => t("Generate pdf"),
- "description" => t("Allows users to Generate pdf.")
- ),
"paper submission form" => array(
"title" => t("paper submission form"),
"description" => t("Paper submission form.")
--
cgit
From 48face413db2535007faec27b4cec38c6f18e061 Mon Sep 17 00:00:00 2001
From: Sashi20
Date: Wed, 17 Feb 2021 14:14:12 +0530
Subject: Mandate atleast one result file field in code submission
---
code.inc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/code.inc b/code.inc
index c14eab1..6e2777c 100755
--- a/code.inc
+++ b/code.inc
@@ -241,6 +241,8 @@ function upload_examples_form_validate($form, &$form_state)
/* check if atleast one source or result file is uploaded */
if (!($_FILES['files']['name']['sourcefile1'] || $_FILES['files']['name']['xcos1']))
form_set_error('sourcefile1', t('Please upload atleast one main or source file or xcos file.'));
+ if (!($_FILES['files']['name']['result1']))
+ form_set_error('result1', t('Please upload atleast one result file.'));
/* check for valid filename extensions */
foreach ($_FILES['files']['name'] as $file_form_name => $file_name)
{
--
cgit