summaryrefslogtreecommitdiffstats
path: root/settings/js/apps.js
blob: 069681e1cd17558e053512c5f25c710946f7110d (plain)
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
$(document).ready(function(){
	$('#leftcontent li').each(function(index,li){
		var app=$.parseJSON($(this).children('span').text());
		$(li).data('app',app);
	});
	$('#leftcontent li').click(function(){
		var app=$(this).data('app');
		$('#rightcontent p').show();
		$('#rightcontent span.name').text(app.name);
		$('#rightcontent span.version').text(app.version);
		$('#rightcontent p.description').text(app.description);
		$('#rightcontent span.author').text(app.author);
		$('#rightcontent span.licence').text(app.licence);
		
		$('#rightcontent input.enable').show();
		$('#rightcontent input.enable').val((app.active)?t('admin','Disable'):t('admin','Enable'));
		$('#rightcontent input.enable').data('appid',app.id);
		$('#rightcontent input.enable').data('active',app.active);
	});
	$('#rightcontent input.enable').click(function(){
		var app=$(this).data('appid');
		var active=$(this).data('active');
		if(app){
			if(active){
				$.post(OC.filePath('admin','ajax','disableapp.php'),{appid:app});
				$('#leftcontent li[data-id="'+app+'"]').removeClass('active');
			}else{
				$.post(OC.filePath('admin','ajax','enableapp.php'),{appid:app});
				$('#leftcontent li[data-id="'+app+'"]').addClass('active');
			}
			active=!active;
			$(this).data('active',active);
			$(this).val((active)?t('admin','Disable'):t('admin','Enable'));
			var appData=$('#leftcontent li[data-id="'+app+'"]');
			appData.active=active;
		}
	});
});