diff options
author | Prashant S | 2019-09-05 11:52:55 +0530 |
---|---|---|
committer | GitHub | 2019-09-05 11:52:55 +0530 |
commit | 1a691646aea5980ef4e8d97db9471593c16b87b2 (patch) | |
tree | 933ebef25e85102d343d9a707bbe893caf95d0d6 | |
parent | 9ac17c336932a57bbe62c90a4e6d8bb555f2753e (diff) | |
parent | 459d01bf495486a270e65d630c77eb114ef5d016 (diff) | |
download | r_tbc_fixer-1a691646aea5980ef4e8d97db9471593c16b87b2.tar.gz r_tbc_fixer-1a691646aea5980ef4e8d97db9471593c16b87b2.tar.bz2 r_tbc_fixer-1a691646aea5980ef4e8d97db9471593c16b87b2.zip |
Merge pull request #2 from prashantsinalkar/master
fixed color visibility
-rwxr-xr-x | js/r_tbc_fixer.js | 34 | ||||
-rwxr-xr-x | js/r_tbc_fixer_edit_category.js | 1 | ||||
-rwxr-xr-x | r_tbc_fixer.module | 50 | ||||
-rwxr-xr-x | r_tbc_fixer_edit_book_category.inc | 8 |
4 files changed, 26 insertions, 67 deletions
diff --git a/js/r_tbc_fixer.js b/js/r_tbc_fixer.js index 92830b6..769d5a5 100755 --- a/js/r_tbc_fixer.js +++ b/js/r_tbc_fixer.js @@ -2,15 +2,13 @@ $(document).ready(function() { var basePath = Drupal.settings.basePath; var modPath = basePath + "r_tbc_fixer/"; - var modPath1 = basePath + "textbook_companion_fixer/aicte/book/"; - $category = $("#fix-tbc-form #edit-category"); $book = $("#fix-tbc-form #edit-book"); $chapter = $("#fix-tbc-form #edit-chapter"); $example = $("#fix-tbc-form #edit-example"); $caption = $("#fix-tbc-form #edit-caption"); $code = $("#fix-tbc-form #edit-code"); - $caption_form = $("#scilab-fixer-caption-form"); - $code_form = $("#scilab-fixer-code-form"); + $caption_form = $("#r-fixer-caption-form"); + $code_form = $("#r-fixer-code-form"); $updating = $("#fix-tbc-page #updating"); $done = $("#fix-tbc-page #done"); $example.attr("multiple", "enabled"); @@ -46,7 +44,7 @@ $book.change(function() { reset("chapter", "example", "caption"); var book_id = $(this).val(); - if (book_id < 0) { + if (book_id < 1) { $(".select-chapter").hide(); $(".select-example").hide(); $(".enter-caption").hide(); @@ -161,7 +159,7 @@ } var chapter_caption = $("#edit-chapter-name").val(); chapter_caption = chapter_caption.trim(); - chapter_caption = caption.replace(/\s\s+/g, ' '); + chapter_caption = chapter_caption.replace(/\s\s+/g, ' '); if(validateCaption(chapter_caption) == true) { alert('Enter valid text for chapter caption'); return false; @@ -172,7 +170,7 @@ } $updating.show(); $.ajax({ - url: modPath + "ajax/update-both/", + url: modPath + "ajax/update-both/" + example_id, type: "POST", data: { example_id: example_id, @@ -207,11 +205,11 @@ } $updating.show(); $.ajax({ - url: modPath + "ajax/update-example/", + url: modPath + "ajax/update-example/" + example_id, type: "POST", data: { example_id: example_id, - caption: caption + caption: caption, }, dataType: "html", success: function(data) { @@ -227,8 +225,9 @@ } else if ($('.chapter-caption-chk').prop('checked') == true) { if (chapter_id != "0") { var chapter_caption = $("#edit-chapter-name").val(); + alert(chapter_caption); chapter_caption = chapter_caption.trim(); - chapter_caption = caption.replace(/\s\s+/g, ' '); + chapter_caption = chapter_caption.replace(/\s\s+/g, ' '); if(validateCaption(chapter_caption) == true) { alert('Enter valid text for chapter caption'); return false; @@ -239,7 +238,7 @@ } $updating.show(); $.ajax({ - url: modPath + "ajax/update-chapter/", + url: modPath + "ajax/update-chapter/" + example_id, type: "POST", data: { chapter_id: chapter_id, @@ -291,18 +290,7 @@ } e.preventDefault(); }); - $Selected = $(".selected"); - $Selected.click(function(e) { - $(".sync-msg").remove(); - $(this).after("<span class='sync-msg'>Saving...</span>"); - $.ajax({ - url: modPath1 + "ajax/selected/" + $(this).attr("data-bid"), - success: function() { - $(".sync-msg").remove(); - console.log("success"); - } - }); - }); + function validateCaption(text){ var re = /([a-zA-Z|*|_|.|+|-|\\|?|/|!|~|!|@|#|$|%|^|&|(|)|<|>|{|}|;|:|\"|\'|,])\1{2,}/; return re.test(text); diff --git a/js/r_tbc_fixer_edit_category.js b/js/r_tbc_fixer_edit_category.js index b141363..bd92502 100755 --- a/js/r_tbc_fixer_edit_category.js +++ b/js/r_tbc_fixer_edit_category.js @@ -125,6 +125,7 @@ data: { pref_id: pref_id, main_category: main_cat_chk_value, + sub_category: '', action: action }, dataType: "html", diff --git a/r_tbc_fixer.module b/r_tbc_fixer.module index 335c184..a444136 100755 --- a/r_tbc_fixer.module +++ b/r_tbc_fixer.module @@ -190,32 +190,7 @@ function R_fixer_ajax($item, $key) { $data = ""; global $user; - if ($item == "category" && $key) { - /* $query = " - SELECT pre.id AS id, pre.book, pre.author FROM textbook_companion_preference pre - LEFT JOIN textbook_companion_proposal pro ON pro.id = pre.proposal_id - WHERE pro.proposal_status = 3 AND pre.approval_status = 1 AND pre.category = %d - ORDER BY pre.book ASC - "; - $result = db_query($query, $key);*/ - $query = db_select('textbook_companion_preference', 'pre'); - $query->fields('pre', array( - 'id', - 'book', - 'author' - )); - $query->leftJoin('textbook_companion_proposal', 'pro', 'pro.id = pre.proposal_id'); - $query->condition('pro.proposal_status', 3); - $query->condition('pre.approval_status', 1); - $query->condition('pre.category', $key); - $query->orderBy('pre.book', 'ASC'); - $result = $query->execute(); - $data .= "<option value='0'>Please select the book.</option>"; - while ($row = $result->fetchObject()) { - $data .= "<option value='{$row->id}'>{$row->book} ({$row->author})</option>"; - } //$row = $result->fetchObject() - } //$item == "category" && $key - else if ($item == "book" && $key) { + if ($item == "book" && $key) { /*$query = "SELECT * FROM {textbook_companion_chapter} WHERE preference_id = %d ORDER BY number"; $result = db_query($query, $key);*/ $query = db_select('textbook_companion_chapter'); @@ -369,18 +344,6 @@ function R_fixer_ajax($item, $key) file_put_contents($example_path, $code); $data .= "updated"; } //$item == "code" && $key - else if ($item == "ind-ed" && $key) { - $query = " - UPDATE textbook_companion_aicte - SET ind = !ind - WHERE id = :id - "; - $args = array( - ":id" => $key - ); - db_query($query, $args); - $data .= "updated"; - } //$item == "ind-ed" && $key else { $data = "<option value='0'>Please select a book</option>"; } @@ -448,17 +411,22 @@ function R_fixer_code_all() } function r_get_tbc_books(){ - $query = " + $query = " SELECT pre.id AS id, pre.book, pre.author FROM textbook_companion_preference pre LEFT JOIN textbook_companion_proposal pro ON pro.id = pre.proposal_id WHERE pro.proposal_status = 3 AND pre.approval_status = 1 ORDER BY pre.book ASC "; $book_list = db_query($query); + $i = 1; $book[0] = "Select any book"; - while ($book_list_data = $book_list->fetchObject()) + while ($book_list_data = $book_list->fetchObject()) { - $book[$book_list_data->id] .= $book_list_data->book ." (by " .$book_list_data->author. ")"; + if (!isset($book[$book_list_data->id])) { + $book[$book_list_data->id] = ''; + } + $book[$book_list_data->id] = $book[$book_list_data->id] . $i . ") ". $book_list_data->book . " (by " . $book_list_data->author . ")"; + $i++; } return $book; } diff --git a/r_tbc_fixer_edit_book_category.inc b/r_tbc_fixer_edit_book_category.inc index 4d5cb04..1b87af7 100755 --- a/r_tbc_fixer_edit_book_category.inc +++ b/r_tbc_fixer_edit_book_category.inc @@ -47,7 +47,7 @@ function get_proposal_status($proposal_value) $proposal_status = ''; switch ($proposal_value) { case 0: - $proposal_status = "<span style='color:#FFFFFF'>Pending</span>"; + $proposal_status = "<span style='color:#000000'>Pending</span>"; break; case 1: $proposal_status = "<span style='color:#FF0000'>Approved</span>"; @@ -140,8 +140,8 @@ function r_tbc_fixer_edit_book_category_ajax() global $user; $data = ""; $item = arg(2); - $main_category = $_POST['main_category']; - $sub_category = $_POST['sub_category']; + $main_category = trim($_POST['main_category']); + $sub_category = trim($_POST['sub_category']); if ($item == "edit-book-category") { if ($_POST['action'] == "add") @@ -361,6 +361,7 @@ function _r_tbc_fixer_list_of_category_checkboxes() //$query->fields(array('category_id','main_category')); $query->orderBy('category_id', 'ASC'); $category_list = $query->execute(); + $category = ""; while ($category_list_data = $category_list->fetchObject()) { $categoryname = $category_list_data->maincategory; @@ -405,6 +406,7 @@ function _r_tbc_fixer_list_of_subcategory($pref_id, $category_id) ':category_id' => $category_id ); $subcategory_list = db_query($query, $args); + $subcategory = ""; while ($subcategory_list_data = $subcategory_list->fetchObject()) { $subcategory .= "<option value='" . $subcategory_list_data->subcat_id . "' data-name='" . $subcategory_list_data->sub_category . "' data-mcid='" . $category_id . "'>" . $subcategory_list_data->sub_category . "</option>"; |