-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathplugins.js
55 lines (47 loc) · 1.26 KB
/
plugins.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
*
* Plugins functions
*
*/
// Update a currently installed plugin
function plugin_update_active(pluginID)
{
if(pluginID == "")
{
alert("No plugin ID given!");
return false;
}
var plgStatus = $('#plg_'+pluginID+'_status').val();
// Confirm delete
if(plgStatus == 'delete')
{
var answer = confirm("Are you sure?\n\nDelete this plugin?");
if(!answer) return false;
}
$.ajax({
url: ajaxURL,
data: 'a=plugin_actions&do=update&id='+pluginID+'&status='+plgStatus,
success:function(html){
if(plgStatus == 'delete') $('#plugin_'+pluginID).fadeOut();
if(html == 'success') infobox('s','');
else infobox('f','<b>Failed:</b> '+html);
}
});
}
// Install a new plugin that has been uploaded
function plugin_install(name)
{
if(name == "")
{
alert("No plugin name given!");
return false;
}
$.ajax({
url: ajaxURL,
data: 'a=plugin_actions&do=install&name='+name,
success:function(html){
if(html == 'success') infobox('s','');
else infobox('f','<b>Failed:</b> '+html);
}
});
}