summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprashantsinalkar2019-09-01 21:51:58 +0530
committerprashantsinalkar2019-09-01 22:13:11 +0530
commit9d7ea3e909c40eec3c078f03c8209ae9b1261c38 (patch)
treec7247aca68141a8518199b3d5e33b7ed3bdd81f3
parent9079093f5ace76555b15e613ca9b8e473aa8461d (diff)
downloadr_tbc_fixer-9d7ea3e909c40eec3c078f03c8209ae9b1261c38.tar.gz
r_tbc_fixer-9d7ea3e909c40eec3c078f03c8209ae9b1261c38.tar.bz2
r_tbc_fixer-9d7ea3e909c40eec3c078f03c8209ae9b1261c38.zip
modifed the code for R tbc
-rwxr-xr-xjs/r_tbc_fixer.js7
-rwxr-xr-xjs/r_tbc_fixer_edit_category.js2
-rwxr-xr-xr_tbc_fixer.info1
-rwxr-xr-xr_tbc_fixer.module7
-rwxr-xr-xr_tbc_fixer_edit_book_category.inc43
5 files changed, 47 insertions, 13 deletions
diff --git a/js/r_tbc_fixer.js b/js/r_tbc_fixer.js
index dbb20d7..92830b6 100755
--- a/js/r_tbc_fixer.js
+++ b/js/r_tbc_fixer.js
@@ -1,4 +1,4 @@
-(function($) {
+ (function($) {
$(document).ready(function() {
var basePath = Drupal.settings.basePath;
var modPath = basePath + "r_tbc_fixer/";
@@ -15,6 +15,7 @@
$done = $("#fix-tbc-page #done");
$example.attr("multiple", "enabled");
+
function reset() {
for (var i = 0, l = arguments.length; i < l; i++) {
switch (arguments[i]) {
@@ -45,7 +46,7 @@
$book.change(function() {
reset("chapter", "example", "caption");
var book_id = $(this).val();
- if (book_id < 1) {
+ if (book_id < 0) {
$(".select-chapter").hide();
$(".select-example").hide();
$(".enter-caption").hide();
@@ -100,6 +101,7 @@
dataType: "html",
success: function(data) {
$example.html(data);
+ $example.attr("size", $("#fix-tbc-form #edit-example option").length);
}
});
});
@@ -115,6 +117,7 @@
$(".well").hide();
$(".update-button").hide();
} else {
+
$(".enter-caption").show();
$("#edit-caption").val(example_name);
$(".example-code-edit").show();
diff --git a/js/r_tbc_fixer_edit_category.js b/js/r_tbc_fixer_edit_category.js
index bad5ec7..b141363 100755
--- a/js/r_tbc_fixer_edit_category.js
+++ b/js/r_tbc_fixer_edit_category.js
@@ -3,7 +3,7 @@
var basePath = Drupal.settings.basePath;
//var modPath = basePath + "textbook_companion_fixer/";
var modPath = basePath +
- "textbook_companion_fixer/ajax/edit-book-category/";
+ "r_tbc_fixer/ajax/edit-book-category/";
$category_form = $("#fix-tbc-category-form");
$(".main-subcategory-table-div").hide();
diff --git a/r_tbc_fixer.info b/r_tbc_fixer.info
index 79b1ac9..b9b857f 100755
--- a/r_tbc_fixer.info
+++ b/r_tbc_fixer.info
@@ -3,3 +3,4 @@ description = "Module to fix R code bugs"
version = "7.1.1"
core = "7.x"
package = IITB
+
diff --git a/r_tbc_fixer.module b/r_tbc_fixer.module
index b89da85..335c184 100755
--- a/r_tbc_fixer.module
+++ b/r_tbc_fixer.module
@@ -47,7 +47,7 @@ function r_tbc_fixer_menu()
);
// edit book categoery
$items["r_tbc_fixer/edit_book_category"] = array(
- "title" => "Edit Completed Books Category",
+ "title" => "Edit Books Category",
"page callback" => "r_tbc_fixer_edit_book_proposal_all",
"access arguments" => array(
"fix R_textbook_category"
@@ -243,7 +243,7 @@ function R_fixer_ajax($item, $key)
} //$item == "chapter" && $key
else if ($item == "example" && $key) {
- $result = db_query("select * from textbook_companion_preference tcp join textbook_companion_chapter tcc on tcp.id=tcc.preference_id join textbook_companion_example tce ON tcc.id=tce.chapter_id join textbook_companion_example_files tcef on tce.id=tcef.example_id where tcef.filetype= 'S' AND tcef.example_id= :example_id", array(
+ $result = db_query("select tcp.directory_name, tce.caption, tcef.filepath from textbook_companion_preference tcp join textbook_companion_chapter tcc on tcp.id=tcc.preference_id join textbook_companion_example tce ON tcc.id=tce.chapter_id join textbook_companion_example_files tcef on tce.id=tcef.example_id where tcef.filetype= 'S' AND tcef.example_id= :example_id", array(
':example_id' => $key
));
$row = $result->fetchObject();
@@ -458,12 +458,13 @@ function r_get_tbc_books(){
$book[0] = "Select any book";
while ($book_list_data = $book_list->fetchObject())
{
- $book[$book_list_data->id] .= $book_list_data->book;
+ $book[$book_list_data->id] .= $book_list_data->book ." (by " .$book_list_data->author. ")";
}
return $book;
}
function r_tbc_fixer_init()
{
+
drupal_add_css(drupal_get_path("module", "r_tbc_fixer") . "/css/r_tbc_fixer.css");
drupal_add_js(drupal_get_path("module", "r_tbc_fixer") . "/js/r_tbc_fixer.js");
drupal_add_js(drupal_get_path("module", "r_tbc_fixer") . "/js/r_tbc_fixer_edit_category.js");
diff --git a/r_tbc_fixer_edit_book_category.inc b/r_tbc_fixer_edit_book_category.inc
index d25cec5..4d5cb04 100755
--- a/r_tbc_fixer_edit_book_category.inc
+++ b/r_tbc_fixer_edit_book_category.inc
@@ -2,20 +2,20 @@
function r_tbc_fixer_edit_book_proposal_all()
{
//get the book count
- $result = db_query("SELECT COUNT( pe.book ) AS book_count FROM {textbook_companion_preference} pe LEFT JOIN {textbook_companion_proposal} po ON pe.proposal_id = po.id WHERE po.proposal_status =3 AND pe.approval_status =1 AND pe.category>0");
+ $result = db_query("SELECT COUNT( pe.book ) AS book_count FROM {textbook_companion_preference} pe LEFT JOIN {textbook_companion_proposal} po ON pe.proposal_id = po.id WHERE pe.approval_status =1 ");
$row = $result->fetchObject();
$book_count = $row->book_count;
$i = 1;
/* get preference */
- $preference_q = db_query("SELECT pe.id as pref_id, pe.book as book, pe.author as author,pe.category as existing_category, pe.publisher as publisher, pe.year as year, pe.id as pe_id, po.approval_date as approval_date
+ $preference_q = db_query("SELECT pe.id as pref_id, pe.book as book, pe.author as author, pe.publisher as publisher, pe.year as year, pe.id as pe_id, po.approval_date as approval_date, po.proposal_status
FROM {textbook_companion_preference} pe LEFT JOIN {textbook_companion_proposal} po ON pe.proposal_id = po.id
- WHERE po.proposal_status = 3 AND pe.approval_status = 1 AND pe.category>0 ORDER BY pe.book ASC");
+ WHERE pe.approval_status = 1 ORDER BY po.proposal_status ASC");
while ($preference_data = $preference_q->fetchObject())
{
$proposal_rows[] = array(
$i,
"{$preference_data->book} <br> <em>by {$preference_data->author}</em>",
- _r_tbc_fixer_list_of_category($preference_data->existing_category),
+ get_proposal_status($preference_data->proposal_status),
_tbc_fixer_list_of_new_category($preference_data->pref_id),
l('Edit', 'r_tbc_fixer/category_edit/' . $preference_data->pref_id)
);
@@ -27,12 +27,12 @@ function r_tbc_fixer_edit_book_proposal_all()
drupal_set_message(t('There are no proposals.'), 'status');
return '';
} //!$proposal_rows
- $output .= "Book count with category: " . $book_count;
+ $output = "Book count: " . $book_count;
$proposal_header = array(
'No.',
'Title of the Book',
- 'Existing Category',
- 'New Category',
+ 'Proposal Status',
+ 'Current Category',
'Action'
);
$output .= theme('table', array(
@@ -41,6 +41,35 @@ function r_tbc_fixer_edit_book_proposal_all()
));
return $output;
}
+
+function get_proposal_status($proposal_value)
+{
+ $proposal_status = '';
+ switch ($proposal_value) {
+ case 0:
+ $proposal_status = "<span style='color:#FFFFFF'>Pending</span>";
+ break;
+ case 1:
+ $proposal_status = "<span style='color:#FF0000'>Approved</span>";
+ break;
+ case 2:
+ $proposal_status = "<span style='color:#00FF00'>Dis-approved</span>";
+ break;
+ case 3:
+ $proposal_status = "<span style='color:#0000FF'>Completed</span>";
+ break;
+ case 4:
+ $proposal_status = "<span style='color:#0000FF'>External</span>";
+ break;
+ case 5:
+ $proposal_status = "<span style='color:#800080'>Submitted all codes</span>";
+ break;
+ default:
+ $proposal_status = "<span style='color:#808000'>Unknown</span>";
+ break;
+ }
+ return $proposal_status;
+}
/******************************************************************************/
/**************************** CATEGORY EDIT FORM ******************************/
/******************************************************************************/