fix disableing/enabling apps

This commit is contained in:
Robin Appelman 2011-08-08 16:33:01 +02:00
parent 3c01c36202
commit 2f95b82934
3 changed files with 4 additions and 6 deletions

View File

@ -1,5 +1,4 @@
<?php <?php
// Init owncloud // Init owncloud
require_once('../../lib/base.php'); require_once('../../lib/base.php');
header( "Content-Type: application/jsonrequest" ); header( "Content-Type: application/jsonrequest" );

View File

@ -1,18 +1,17 @@
$("input[x-use='appenablebutton']").live( "click", function(){ $("input[x-use='appenablebutton']").live( "click", function(){
appid = $(this).parent().parent().attr("x-uid"); appid = $(this).parent().data("uid");
//alert("dsfsdfsdf"); //alert("dsfsdfsdf");
if($(this).val() == "enabled"){ if($(this).val() == "enabled"){
$(this).attr("value","disabled"); $(this).attr("value","disabled");
$(this).removeClass( "enabled" ); $(this).removeClass( "enabled" );
$(this).addClass( "disabled" ); $(this).addClass( "disabled" );
//$.post( "ajax/disableapp.php", $(appid).serialize(), function(data){} ); $.post( "ajax/disableapp.php", 'appid='+appid);
$.post( "ajax/disableapp.php", { appid: appid }, function(data){ alert(data.status);});
} }
else if($(this).val() == "disabled"){ else if($(this).val() == "disabled"){
$(this).attr("value","enabled"); $(this).attr("value","enabled");
$(this).removeClass( "disabled" ); $(this).removeClass( "disabled" );
$(this).addClass( "enabled" ); $(this).addClass( "enabled" );
$.post( "ajax/enableapp.php", { appid: appid }, function(data){ alert(data.status);} ); $.post( "ajax/enableapp.php", 'appid='+appid);
} }
}); });

View File

@ -1,6 +1,6 @@
<ul id="apps"> <ul id="apps">
<?php foreach($_["apps"] as $app): ?> <?php foreach($_["apps"] as $app): ?>
<li x-uid="<?php echo($app['id']); ?>"><strong><?php echo($app['name']); ?></strong> <?php echo($app['version']); ?> <em>by <?php echo($app['author']); ?></em> <li data-uid="<?php echo($app['id']); ?>"><strong><?php echo($app['name']); ?></strong> <?php echo($app['version']); ?> <em>by <?php echo($app['author']); ?></em>
<input x-use="appenablebutton" type="submit" value="<?php echo $l->t( $app['enabled'] ? 'enabled' : 'disabled' ); ?>" class="appbutton <?php echo( $app['enabled'] ? 'enabled' : 'disabled' ); ?>" /> <input x-use="appenablebutton" type="submit" value="<?php echo $l->t( $app['enabled'] ? 'enabled' : 'disabled' ); ?>" class="appbutton <?php echo( $app['enabled'] ? 'enabled' : 'disabled' ); ?>" />
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>