diff --git a/admin/ajax/disableapp.php b/admin/ajax/disableapp.php new file mode 100644 index 0000000000000000000000000000000000000000..d23f8de7ef0f6c78b7ef862c159abc4977b47b3d --- /dev/null +++ b/admin/ajax/disableapp.php @@ -0,0 +1,9 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); +header( "Content-Type: application/jsonrequest" ); + +OC_APP::disable($_POST['appid']); + +?> diff --git a/admin/ajax/enableapp.php b/admin/ajax/enableapp.php new file mode 100644 index 0000000000000000000000000000000000000000..d988d7fd2dfd9605235705c52dffb131da3aa42b --- /dev/null +++ b/admin/ajax/enableapp.php @@ -0,0 +1,9 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); +header( "Content-Type: application/jsonrequest" ); + +OC_APP::enable($_POST['appid']); + +?> diff --git a/admin/apps.php b/admin/apps.php index 725128a7523c0e5efdb864873d30ebb8457774aa..5eec7e626d32ba79ee4f24b44ed2a2fa91187d43 100644 --- a/admin/apps.php +++ b/admin/apps.php @@ -30,6 +30,7 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' // Load the files we need OC_UTIL::addStyle( "admin", "apps" ); +OC_UTIL::addScript( "admin", "apps" ); if(isset($_GET['id'])) $id=$_GET['id']; else $id=0; @@ -42,7 +43,6 @@ if($installed){ $records = array(); OC_APP::setActiveNavigationEntry( "core_apps_installed" ); - echo count($apps); foreach($apps as $app){ $info=OC_APP::getAppInfo("$SERVERROOT/apps/$app/appinfo/info.xml"); $record = array( 'id' => $app, diff --git a/admin/js/apps.js b/admin/js/apps.js new file mode 100644 index 0000000000000000000000000000000000000000..4d8c68171bdd26901cabed1abe3fa44e2ce0c589 --- /dev/null +++ b/admin/js/apps.js @@ -0,0 +1,17 @@ +$("div[x-use='appenableddiv']").live( "click", function(){ + appid = $(this).parent().parent().attr("x-uid"); + + if($(this).text() == "enabled"){ + $(this).html( "disabled" ); + $(this).parent().removeClass( "enabled" ); + $(this).parent().addClass( "disabled" ); + //$.post( "ajax/disableapp.php", $(appid).serialize(), function(data){} ); + $.post( "ajax/disableapp.php", { appid: appid }, function(data){ alert(data.status);}); + } + else if($(this).text() == "disabled"){ + $(this).html( "enabled" ); + $(this).parent().removeClass( "disabled" ); + $(this).parent().addClass( "enabled" ); + $.post( "ajax/enableapp.php", { appid: appid }, function(data){ alert(data.status);} ); + } +}); \ No newline at end of file diff --git a/admin/templates/appsinst.php b/admin/templates/appsinst.php index c1acc09d5d3e22fd1222769aa2c9a011082402c1..482273da1df6ae526d2a44e52b588930a9e8e375 100644 --- a/admin/templates/appsinst.php +++ b/admin/templates/appsinst.php @@ -16,11 +16,11 @@ </thead> <tbody> <?php foreach($_["apps"] as $app): ?> - <tr> + <tr x-uid="<?php echo($app['id']); ?>"> <td class="name" width="200"><?php echo($app['name']); ?></td> <td class="version"><?php echo($app['version']); ?></td> <td><?php echo($app['author']); ?></td> - <td class="<?php echo $app['enabled'] ? 'enabled' : 'disabled' ?>"><?php echo $l->t( $app['enabled'] ? 'enabled' : 'disabled' ); ?></td> + <td class="<?php echo $app['enabled'] ? 'enabled' : 'disabled' ?>"><div x-use="appenableddiv"><?php echo $l->t( $app['enabled'] ? 'enabled' : 'disabled' ); ?></div></td> </tr> <?php endforeach; ?> </tbody> diff --git a/admin/templates/users.php b/admin/templates/users.php index c6ee57a61d501ca4bb382ae6f241f520427b7cb7..0c26fd3bdf48a23f69f5a2623b38243ab6a13194 100644 --- a/admin/templates/users.php +++ b/admin/templates/users.php @@ -4,7 +4,7 @@ <thead> <tr> <th><?php echo $l->t( 'Name' ); ?></th> - <th>Groups</th> + <th><?php echo $l->t( 'Groups' ); ?></th> <th></th> </tr> </thead>