summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorKamil Domanski <kdomanski@kdemail.net>2011-06-20 19:21:42 +0200
committerKamil Domanski <kdomanski@kdemail.net>2011-06-20 20:46:31 +0200
commitd38e958ada1390c36112ab2b0b4b28d1cae3e1df (patch)
tree9725b0a33fd9a9272cc4d3442222ab7df6d5617b /admin
parent0f0d37b85cfd3aea57c1d54ff005d881b55af304 (diff)
downloadnextcloud-server-d38e958ada1390c36112ab2b0b4b28d1cae3e1df.tar.gz
nextcloud-server-d38e958ada1390c36112ab2b0b4b28d1cae3e1df.zip
enable/disable apps by clicking their status
Diffstat (limited to 'admin')
-rw-r--r--admin/ajax/disableapp.php9
-rw-r--r--admin/ajax/enableapp.php9
-rw-r--r--admin/apps.php2
-rw-r--r--admin/js/apps.js17
-rw-r--r--admin/templates/appsinst.php4
5 files changed, 38 insertions, 3 deletions
diff --git a/admin/ajax/disableapp.php b/admin/ajax/disableapp.php
new file mode 100644
index 00000000000..d23f8de7ef0
--- /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 00000000000..d988d7fd2df
--- /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 725128a7523..5eec7e626d3 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 00000000000..4d8c68171bd
--- /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 c1acc09d5d3..482273da1df 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>