summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorJakob Sack <mail@jakobsack.de>2011-03-01 23:20:16 +0100
committerJakob Sack <mail@jakobsack.de>2011-03-01 23:20:16 +0100
commit132695ceb1d7ab0e4bfbb141e9e9639111dd25b5 (patch)
treef53fabcefd89a1e5bbeda9a2c2d2fff6683139d4 /admin
parent1fd39a52fa750878e7d70fba63c099f252095762 (diff)
downloadnextcloud-server-132695ceb1d7ab0e4bfbb141e9e9639111dd25b5.tar.gz
nextcloud-server-132695ceb1d7ab0e4bfbb141e9e9639111dd25b5.zip
Start of the refactoring. Commit is quite big because I forgot to use git right from the beginning. Sorry.
Diffstat (limited to 'admin')
-rw-r--r--admin/appinfo.php12
-rw-r--r--admin/index.php44
-rw-r--r--admin/plugins.php51
-rw-r--r--admin/system.php43
-rw-r--r--admin/templates/_c/.gitkeep0
-rw-r--r--admin/templates/index.tmpl7
-rw-r--r--admin/templates/plugins.tmpl23
-rw-r--r--admin/templates/system.tmpl3
-rw-r--r--admin/templates/users.tmpl39
-rw-r--r--admin/users.php54
10 files changed, 255 insertions, 21 deletions
diff --git a/admin/appinfo.php b/admin/appinfo.php
new file mode 100644
index 00000000000..0b2e4dbf85d
--- /dev/null
+++ b/admin/appinfo.php
@@ -0,0 +1,12 @@
+<?php
+
+OC_UTIL::addApplication( array( "id" => "admin", "name" => "Administration" ));
+if( OC_USER::ingroup( $_SESSION['username'], 'admin' ))
+{
+ OC_UTIL::addNavigationEntry( array( "app" => "admin", "file" => "index.php", "name" => "Administration" ));
+}
+OC_UTIL::addAdminPage( array( "app" => "admin", "file" => "system.php", "name" => "System Settings" ));
+OC_UTIL::addAdminPage( array( "app" => "admin", "file" => "users.php", "name" => "Users" ));
+OC_UTIL::addAdminPage( array( "app" => "admin", "file" => "plugins.php", "name" => "Plugins" ));
+
+?>
diff --git a/admin/index.php b/admin/index.php
index 92c465e8d61..a9cc079c875 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -3,39 +3,41 @@
/**
* ownCloud
*
-* @author Frank Karlitschek
-* @copyright 2010 Frank Karlitschek karlitschek@kde.org
-*
+* @author Frank Karlitschek
+* @copyright 2010 Frank Karlitschek karlitschek@kde.org
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either
+* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*
-* You should have received a copy of the GNU Affero General Public
+*
+* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
-*
+*
*/
-$CONFIG_ERROR='';
-
-require_once('../inc/lib_base.php');
+require_once('../lib/base.php');
+oc_require( 'template.php' );
+if( !OC_USER::isLoggedIn()){
+ header( "Location: ".OC_UTIL::linkto( "index.php" ));
+ exit();
+}
+$adminpages = array();
-OC_UTIL::showheader();
+foreach( OC_UTIL::$adminpages as $i ){
+ // Do some more work here soon
+ $adminpages[] = $i;
+}
-$FIRSTRUN=false;
-
-echo('<div class="center">');
-OC_CONFIG::showadminform();
-echo('</div>');
-
-
-OC_UTIL::showfooter();
+$tmpl = new OC_TEMPLATE( "admin", "index", "admin" );
+$tmpl->assign( "adminpages", $adminpages );
+$tmpl->printPage();
?>
-
+
diff --git a/admin/plugins.php b/admin/plugins.php
new file mode 100644
index 00000000000..36139edab04
--- /dev/null
+++ b/admin/plugins.php
@@ -0,0 +1,51 @@
+<?php
+
+/**
+* ownCloud
+*
+* @author Frank Karlitschek
+* @copyright 2010 Frank Karlitschek karlitschek@kde.org
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+require_once('../lib/base.php');
+oc_require( 'template.php' );
+if( !OC_USER::isLoggedIn()){
+ header( "Location: ".OC_UTIL::linkto( "index.php" ));
+ exit();
+}
+
+$plugins=array();
+$blacklist=OC_PLUGIN::loadBlackList();
+
+foreach( OC_PLUGIN::listPlugins() as $i ){
+ // Gather data about plugin
+ $data = OC_PLUGIN::getPluginData($plugin);
+
+ // Is it enabled?
+ $data["enabled"] = ( array_search( $plugin, $blacklist ) === false );
+
+ // Add the data
+ $plugins[] = $data;
+}
+
+
+$tmpl = new OC_TEMPLATE( "admin", "plugins", "admin" );
+$tmpl->assign( "plugins", $plugins );
+$tmpl->printPage();
+
+?>
+
diff --git a/admin/system.php b/admin/system.php
new file mode 100644
index 00000000000..a9cc079c875
--- /dev/null
+++ b/admin/system.php
@@ -0,0 +1,43 @@
+<?php
+
+/**
+* ownCloud
+*
+* @author Frank Karlitschek
+* @copyright 2010 Frank Karlitschek karlitschek@kde.org
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+require_once('../lib/base.php');
+oc_require( 'template.php' );
+if( !OC_USER::isLoggedIn()){
+ header( "Location: ".OC_UTIL::linkto( "index.php" ));
+ exit();
+}
+
+$adminpages = array();
+
+foreach( OC_UTIL::$adminpages as $i ){
+ // Do some more work here soon
+ $adminpages[] = $i;
+}
+
+$tmpl = new OC_TEMPLATE( "admin", "index", "admin" );
+$tmpl->assign( "adminpages", $adminpages );
+$tmpl->printPage();
+
+?>
+
diff --git a/admin/templates/_c/.gitkeep b/admin/templates/_c/.gitkeep
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/admin/templates/_c/.gitkeep
diff --git a/admin/templates/index.tmpl b/admin/templates/index.tmpl
new file mode 100644
index 00000000000..d6db07f7194
--- /dev/null
+++ b/admin/templates/index.tmpl
@@ -0,0 +1,7 @@
+<h1>Administration</h1>
+
+<ul>
+ [%foreach $adminpages as $i%]
+ <li><a href="[%linkto app=$i.app file=$i.file%]">[%$i.name%]</a></li>
+ [%/foreach%]
+</ul>
diff --git a/admin/templates/plugins.tmpl b/admin/templates/plugins.tmpl
new file mode 100644
index 00000000000..ca32a877256
--- /dev/null
+++ b/admin/templates/plugins.tmpl
@@ -0,0 +1,23 @@
+<h1>Administration</h1>
+<h2>Plugins</h2>
+
+<table>
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Description</th>
+ <th>Version</th>
+ <th>Author</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ [%foreach $plugins as $plugin%]
+ <td>[%$plugin.info.id%]</td>
+ <td>[%$plugin.info.version%]</td>
+ <td>[%$plugin.info.name%]</td>
+ <td>[%$plugin.info.author%]</td>
+ <td>enable</td>
+ [%/foreach%]
+ </tbody>
+</table>
diff --git a/admin/templates/system.tmpl b/admin/templates/system.tmpl
new file mode 100644
index 00000000000..bab436de8dc
--- /dev/null
+++ b/admin/templates/system.tmpl
@@ -0,0 +1,3 @@
+<h1>Administration</h1>
+<h2>System Settings</h2>
+#TBD \ No newline at end of file
diff --git a/admin/templates/users.tmpl b/admin/templates/users.tmpl
new file mode 100644
index 00000000000..796b55de4e0
--- /dev/null
+++ b/admin/templates/users.tmpl
@@ -0,0 +1,39 @@
+<h1>Administration</h1>
+<h2>Users</h2>
+
+<table>
+ <thead>
+ <tr>
+ <th></th>
+ <th>Name</th>
+ <th>Groups</th>
+ </tr>
+ <thead>
+ <tbody>
+ [%foreach $users as $user%]
+ <tr>
+ <td><input type="checkbox"></td>
+ <td>[%$user.name%]</td>
+ <td>[%$user.groups%]</td>
+ </tr>
+ [%/foreach%]
+ </tbody>
+</table>
+
+<h2>Groups</h2>
+<table>
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th></th>
+ </tr>
+ <thead>
+ <tbody>
+ [%foreach $groups as $group%]
+ <tr>
+ <td>[%$group.name%]</td>
+ <td>remove</td>
+ </tr>
+ [%/foreach%]
+ </tbody>
+</table>
diff --git a/admin/users.php b/admin/users.php
new file mode 100644
index 00000000000..77be508914b
--- /dev/null
+++ b/admin/users.php
@@ -0,0 +1,54 @@
+<?php
+
+/**
+* ownCloud
+*
+* @author Frank Karlitschek
+* @copyright 2010 Frank Karlitschek karlitschek@kde.org
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+require_once('../lib/base.php');
+oc_require( 'template.php' );
+if( !OC_USER::isLoggedIn()){
+ header( "Location: ".OC_UTIL::linkto( "index.php" ));
+ exit();
+}
+
+$users = array();
+$groups = array();
+
+foreach( OC_USER::getUsers() as $i ){
+ // Do some more work here soon
+ $ingroups = array();
+ foreach( OC_USER::getUserGroups( $i ) as $userGroup){
+ $ingroup[] = OC_USER::getGroupName( $userGroup );
+ }
+ $users[] = array( "name" => $i, "groups" => join( ",", $ingroups ));
+}
+
+foreach( OC_USER::getGroups() as $i ){
+ // Do some more work here soon
+ $groups[] = array( "name" => $i );
+}
+
+$tmpl = new OC_TEMPLATE( "admin", "users", "admin" );
+$tmpl->assign( "users", $users );
+$tmpl->assign( "groups", $groups );
+$tmpl->printPage();
+
+?>
+