1 |
2
|
Manuela
|
|
2 |
|
|
//console.info('News ==='+typeof News);
|
3 |
|
|
// Function to toggle active/inavtive of a categorie in the overview
|
4 |
|
|
function toggle_active_inactive(id) {
|
5 |
|
|
var img = $("#i" + id);
|
6 |
|
|
console.log(img);
|
7 |
|
|
if( img.attr("src") == News.ThemeUrl+"/img/24/active_1.png") {
|
8 |
|
|
var action = "disable";
|
9 |
|
|
var src = News.ThemeUrl+"/img/24/active_0.png";
|
10 |
|
|
} else {
|
11 |
|
|
var action = "enable";
|
12 |
|
|
var src = News.ThemeUrl+"/img/24/active_1.png";
|
13 |
|
|
}
|
14 |
|
|
$.ajax({
|
15 |
|
|
url: News.AddonUrl+"/ajax/post_switch_active_inactive.php",
|
16 |
|
|
type: "POST",
|
17 |
|
|
data: 'cat_id='+id+'&action='+action,
|
18 |
|
|
dataType: 'json',
|
19 |
|
|
success: function(data) {
|
20 |
|
|
if(data.success == "true") {
|
21 |
|
|
img.attr("src", src);
|
22 |
|
|
img.attr("title", data.message);
|
23 |
|
|
} else {
|
24 |
|
|
alert(data.message);
|
25 |
|
|
}
|
26 |
|
|
},
|
27 |
|
|
complete: function() {}
|
28 |
|
|
});
|
29 |
|
|
}
|
30 |
|
|
// End of toggle_active_inactive
|
31 |
|
|
|
32 |
|
|
/*-------------------------------------------------------------------------------------------------*/
|
33 |
|
|
if (typeof News ==="object"){
|
34 |
|
|
var NW_MODULE_URL = News.AddonUrl;
|
35 |
|
|
var NW_ICONS = News.ThemeUrl + 'img';
|
36 |
|
|
var NW_AJAX_PLUGINS = News.AddonUrl + 'ajax'; // this var could change in the future
|
37 |
|
|
var LANGUAGE = LANGUAGE ? LANGUAGE : 'EN'; // set var LANGUAGE to EN if LANGUAGE not set before
|
38 |
|
|
/*
|
39 |
|
|
console.info(News.AddonUrl + 'ajax' +"/ajaxActiveStatus.js");
|
40 |
|
|
console.info(NW_AJAX_PLUGINS);
|
41 |
|
|
DB_COLUMN: 'post_id',
|
42 |
|
|
*/
|
43 |
|
|
$.insert( News.AddonUrl + 'ajax' +"/ajaxActiveStatus.js");
|
44 |
|
|
// AjaxHelper change item active status
|
45 |
|
|
$("td.toggle_active_status").ajaxActiveStatus({
|
46 |
|
|
MODULE : News.AddonUrl,
|
47 |
|
|
DB_RECORD_TABLE: '',
|
48 |
|
|
DB_COLUMN: 'post_id',
|
49 |
|
|
sIdKey: ''
|
50 |
|
|
});
|
51 |
|
|
}
|