summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSashi202021-02-23 15:27:06 +0530
committerGitHub2021-02-23 15:27:06 +0530
commit3acc5486540ace650aaa0fe3448ca04590541ab1 (patch)
treeafdd5a09566b80990e4a1e97de747cc46a72f1b4
parent42390452e7128d8e11f4117625d16f4d976bb263 (diff)
parent48face413db2535007faec27b4cec38c6f18e061 (diff)
downloadxcos_textbook_companion-3acc5486540ace650aaa0fe3448ca04590541ab1.tar.gz
xcos_textbook_companion-3acc5486540ace650aaa0fe3448ca04590541ab1.tar.bz2
xcos_textbook_companion-3acc5486540ace650aaa0fe3448ca04590541ab1.zip
Merge pull request #8 from Sashi20/development
Update fields in proposal form, add guidelines page before code submi…
-rwxr-xr-xcode.inc8
-rwxr-xr-xgeneral.inc120
-rwxr-xr-xmanage_proposal.inc3
-rw-r--r--proposal.inc7
-rwxr-xr-xxcos_textbook_companion.module54
5 files changed, 147 insertions, 45 deletions
diff --git a/code.inc b/code.inc
index 9459ad0..6e2777c 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']))
@@ -235,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)
{
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 .= '<strong>Title of the Book:</strong><br />' . $preference_data->book . '<br /><br />';
$return_html .= '<strong>Contributor Name:</strong><br />' . $proposal_data->full_name . '<br /><br />';
@@ -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('<p><span style="color:#696969"><strong>All the guidelines should be followed without fail for timely acceptance of code. Failure to do so might result in rejection of your work. </strong></span></p>
+
+<ol>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">Visit </span><a href="https://scilab.in/Completed_Books" target="_blank">this</a><span style="background-color:transparent; font-family:arial; font-size:11pt"> page and click on your proposed Scilab TBC. You will now get an option to download the Scilab code for the chosen TBC.&nbsp;</span></span></p>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">System Requirement</span></span></p>
+
+ <ol>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">You have to use Scilab 6.1.0 and above for creating the Xcos examples.&nbsp;</span></span></p>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">You may use a different version of Scilab for executing the Scilab TBC code, if required.</span></span></p>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">You may use a Windows/Linux/Mac OS</span></span></p>
+ </li>
+ </ol>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">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.</span></span></p>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">Dependency files</span></span></p>
+
+ <ol>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">Use .sce extension for writing code while setting up the parameters for an Xcos diagram.</span></span></p>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">Use .sci extension for writing code for user defined functions.</span></span></p>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">These dependencies (if any) must be mentioned in a textbox clearly in the Xcos diagram.</span></span></p>
+ </li>
+ </ol>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">Do not include problem statements/text from the book in the diagram.</span></span></p>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">Plotting</span></span></p>
+
+ <ol>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">All the plots must have appropriate labels on its axes.</span></span></p>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">If a single plot contains several graphs then a legend must be added to help&nbsp;differentiate between different plots.</span></span></p>
+ </li>
+ </ol>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">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, </span>"θ" <span style="background-color:transparent; font-family:arial; font-size:11pt">can be written as "theta".</span></span></p>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">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).</span></span></p>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">Label the input/output blocks and superblocks (if applicable) used in Xcos diagram using a textbox.</span></span></p>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">Label the numeric output blocks that display the results,&nbsp;with proper units.</span></span></p>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">If the </span><strong>textbook contains errors</strong><span style="background-color:transparent; font-family:arial; font-size:11pt"> in calculations/results, </span><strong>mention </strong><span style="background-color:transparent; font-family:arial; font-size:11pt">the same in the block diagram itself by using the textbox.</span></span></p>
+
+ <ol>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">If the degree of error is less than +/- 2 then </span><em>"The answers vary due to round off error"</em><span style="background-color:transparent; font-family:arial; font-size:11pt"> must be mentioned</span></span></p>
+ </li>
+ <li dir="ltr">
+ <p dir="ltr"><span style="color:#696969"><span style="background-color:transparent; font-family:arial; font-size:11pt">If the degree of error is more than +/- 2 then </span><em>"The answer provided in the textbook is wrong"</em><span style="background-color:transparent; font-family:arial; font-size:11pt"> must be mentioned.</span></span></p>
+ </li>
+ </ol>
+ </li>
+</ol>
+'),
+ );
+ $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' => '<div id="ajax_tbc_pref_data_replace"></div>',
);
+ $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.")