summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprashant2014-09-25 15:14:21 +0530
committerprashant2014-09-25 15:14:21 +0530
commit1fc8484b3ad7858ee19b3658ac3f3d099e1e54c9 (patch)
treec7ea5221d53e335d44c3ad6c23d148f4203a29b8
parent107d64f7166cca11233a690ee127838bade6108d (diff)
downloadscilab_fixer-1fc8484b3ad7858ee19b3658ac3f3d099e1e54c9.tar.gz
scilab_fixer-1fc8484b3ad7858ee19b3658ac3f3d099e1e54c9.tar.bz2
scilab_fixer-1fc8484b3ad7858ee19b3658ac3f3d099e1e54c9.zip
added aicte book disable eanble functionaty
-rwxr-xr-x[-rw-r--r--]css/scilab_fixer.css6
-rwxr-xr-x[-rw-r--r--]js/scilab_fixer.js17
-rwxr-xr-x[-rw-r--r--]js/selection.js0
-rwxr-xr-xscilab_fixer.module45
4 files changed, 58 insertions, 10 deletions
diff --git a/css/scilab_fixer.css b/css/scilab_fixer.css
index 4047749..5634290 100644..100755
--- a/css/scilab_fixer.css
+++ b/css/scilab_fixer.css
@@ -39,3 +39,9 @@ textarea#edit-code {
.orange {
background: #FF9933 !important;
}
+.sync-msg {
+ font-size: .8em;
+}
+.messages.success {
+ background: lightgreen;
+}
diff --git a/js/scilab_fixer.js b/js/scilab_fixer.js
index b48832e..657cb61 100644..100755
--- a/js/scilab_fixer.js
+++ b/js/scilab_fixer.js
@@ -1,6 +1,9 @@
$(document).ready(function() {
var basePath = Drupal.settings.basePath;
var modPath = basePath + "fix/";
+ var modPath1 = basePath + "fix/aicte/book/";
+
+
$category = $("#fix-tbc-form #edit-category");
$book = $("#fix-tbc-form #edit-book");
@@ -155,6 +158,20 @@ $(document).ready(function() {
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");
+ }
+ });
+
+ });
+
/* toggle in edition */
$ind_ed = $(".ind-ed");
diff --git a/js/selection.js b/js/selection.js
index 6834aca..6834aca 100644..100755
--- a/js/selection.js
+++ b/js/selection.js
diff --git a/scilab_fixer.module b/scilab_fixer.module
index 5e210f4..33235e1 100755
--- a/scilab_fixer.module
+++ b/scilab_fixer.module
@@ -11,7 +11,6 @@
"title" => "Add AICTE books",
"page callback" => "scilab_fixer_aicte_all",
"access arguments" => array("fix scilab"),
- "access arguments" => array("fix scilab"),
"weight" => 30,
"type" => MENU_NORMAL_ITEM
);
@@ -28,7 +27,7 @@
"access arguments" => array("fix scilab"),
"weight" => 2,
"type" => MENU_LOCAL_TASK
- );
+ );
$items["fix/aicte/in"] = array(
"title" => "Mark Indian edition books",
"page callback" => "scilab_fixer_aicte_in_all",
@@ -37,8 +36,7 @@
);
$items["fix/code"] = array(
"title" => "Edit TBC code",
- "page callback" => "scilab_fixer_code_all",
- "access arguments" => array("fix scilab"),
+ "page callback" => "scilab_fixer_code_all",
"access arguments" => array("fix scilab"),
"type" => MENU_CALLBACK
);
@@ -47,6 +45,11 @@
"access callback" => TRUE,
"type" => MENU_CALLBACK
);
+ $items["fix/aicte/book/ajax"] = array(
+ "page callback" => "scilab_fixer_aicte_ajax",
+ "access callback" => TRUE,
+ "type" => MENU_CALLBACK
+ );
return $items;
}
@@ -208,12 +211,27 @@
";
db_query($query, $key);
$data .= "updated";
- } else {
+ }else {
$data = "Nothing to display.";
}
echo $data;
exit();
}
+ function scilab_fixer_aicte_ajax($item="", $key="") {
+ $data = "";
+ if($item == "selected") {
+ $query = "
+ UPDATE textbook_companion_aicte
+ SET selected = !selected
+ WHERE id = {$key}
+ ";
+ db_query($query);
+ $data = "updated";
+ }
+ echo $data;
+ exit();
+ }
+
function scilab_fixer_aicte_form($form_state, $aicte_id) {
$query = "
@@ -342,7 +360,7 @@
}
function scilab_fixer_aicte_edit_all($aicte_id=0) {
- $page_content = "";
+ $page_content = "";
if($aicte_id) {
$page_content .= drupal_get_form("scilab_fixer_aicte_form", $aicte_id);
} else {
@@ -356,22 +374,29 @@
"Edition", "Action",
);
$rows = array();
+
while($row = db_fetch_object($result)) {
- $item = array(
+ $item = array(
"{$row->book}",
"{$row->author}",
"{$row->edition}",
- l(t("Edit"), "fix/aicte/edit/{$row->id}")
+ l(t("Edit"), "fix/aicte/edit/{$row->id}")
);
+ if($row->selected) {
+ $check = "<input class='selected' type='checkbox' data-bid='{$row->id}' checked>";
+ } else {
+ $check = "<input class='selected' type='checkbox' data-bid='{$row->id}'>";
+ }
+ array_push($item, $check);
array_push($rows, $item);
- }
+ }
$page_content .= theme("table", $headers, $rows);
}
return $page_content;
}
function scilab_fixer_aicte_in_all(){
- $page_content = "";
+ $page_content = "";
$query = "
SELECT * FROM textbook_companion_aicte
";