2011-08-23 03:40:13 +04:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
2011-08-10 14:20:43 +04:00
|
|
|
$(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();
|
2011-08-16 01:31:59 +04:00
|
|
|
$('#rightcontent input.enable').val((app.active)?t('settings','Disable'):t('settings','Enable'));
|
2011-08-10 14:20:43 +04:00
|
|
|
$('#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){
|
2011-08-16 01:31:59 +04:00
|
|
|
$.post(OC.filePath('settings','ajax','disableapp.php'),{appid:app});
|
2011-08-10 14:20:43 +04:00
|
|
|
$('#leftcontent li[data-id="'+app+'"]').removeClass('active');
|
|
|
|
}else{
|
2011-08-16 01:31:59 +04:00
|
|
|
$.post(OC.filePath('settings','ajax','enableapp.php'),{appid:app});
|
2011-08-10 14:20:43 +04:00
|
|
|
$('#leftcontent li[data-id="'+app+'"]').addClass('active');
|
|
|
|
}
|
|
|
|
active=!active;
|
|
|
|
$(this).data('active',active);
|
2011-08-16 01:31:59 +04:00
|
|
|
$(this).val((active)?t('settings','Disable'):t('settings','Enable'));
|
2011-08-10 14:20:43 +04:00
|
|
|
var appData=$('#leftcontent li[data-id="'+app+'"]');
|
|
|
|
appData.active=active;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|