@@ -5,8 +5,10 @@ if( OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' )) | |||
{ | |||
OC_APP::addNavigationEntry( array( "id" => "admin_index", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "index.php" ), "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ), "name" => "Administration" )); | |||
} | |||
OC_APP::addAdminPage( array( "order" => 1, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" => "System settings" )); | |||
OC_APP::addAdminPage( array( "order" => 2, "href" => OC_HELPER::linkTo( "admin", "users.php" ), "name" => "Users" )); | |||
OC_APP::addAdminPage( array( "order" => 3, "href" => OC_HELPER::linkTo( "admin", "plugins.php" ), "name" => "Plugins" )); | |||
OC_APP::addAdminPage( array( "id" => "core_basic", "order" => 1, "href" => OC_HELPER::linkTo( "admin", "basic.php" ), "name" => "Basic Settings" )); | |||
OC_APP::addAdminPage( array( "id" => "core_system", "order" => 2, "href" => OC_HELPER::linkTo( "admin", "system.php" ), "name" => "System settings" )); | |||
OC_APP::addAdminPage( array( "id" => "core_users", "order" => 3, "href" => OC_HELPER::linkTo( "admin", "users.php" ), "name" => "Users" )); | |||
OC_APP::addAdminPage( array( "id" => "core_apps", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php" ), "name" => "Apps" )); | |||
OC_APP::addAdminPage( array( "id" => "core_plugins", "order" => 5, "href" => OC_HELPER::linkTo( "admin", "plugins.php" ), "name" => "Plugins" )); | |||
?> |
@@ -28,15 +28,21 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' | |||
exit(); | |||
} | |||
$adminpages = array(); | |||
$apppages = array(); | |||
$syspages = array(); | |||
foreach( OC_APP::getAdminPages() as $i ){ | |||
// Do some more work here soon | |||
$adminpages[] = $i; | |||
if( substr( $i["id"], 0, 5 ) == "core_" ){ | |||
$syspages[] = $i; | |||
} | |||
else{ | |||
$apppages[] = $i; | |||
} | |||
} | |||
$tmpl = new OC_TEMPLATE( "admin", "index", "admin" ); | |||
$tmpl->assign( "adminpages", $adminpages ); | |||
$tmpl->assign( "apppages", $apppages ); | |||
$tmpl->assign( "syspages", $syspages ); | |||
$tmpl->printPage(); | |||
?> |
@@ -5,8 +5,15 @@ | |||
?> | |||
<h1>Administration</h1> | |||
<h2>System</h2> | |||
<ul> | |||
<?php foreach($_["adminpages"] as $i): ?> | |||
<?php foreach($_["syspages"] as $i): ?> | |||
<li><a href="<?php echo $i["href"]; ?>"><?php echo $i["name"]; ?></a></li> | |||
<?php endforeach; ?> | |||
</ul> | |||
<h2>Applications</h2> | |||
<ul> | |||
<?php foreach($_["apppages"] as $i): ?> | |||
<li><a href="<?php echo $i["href"]; ?>"><?php echo $i["name"]; ?></a></li> | |||
<?php endforeach; ?> | |||
</ul> |
@@ -9,36 +9,71 @@ | |||
<table> | |||
<thead> | |||
<tr> | |||
<th></th> | |||
<th>Name</th> | |||
<th>Groups</th> | |||
<th></th> | |||
</tr> | |||
<thead> | |||
<tbody> | |||
<?php foreach($_["users"] as $user): ?> | |||
<tr> | |||
<td><input type="checkbox"></td> | |||
<td><?php echo $user["name"]; ?></td> | |||
<td><?php echo $user["groups"]; ?></td> | |||
<td><a href="" class="edituser-button">edit</a> | <a class="removeuser-button" href="">remove</a></td> | |||
</tr> | |||
<?php endforeach; ?> | |||
</tbody> | |||
</table> | |||
<a id="adduser-button" href="">New user</a> | |||
<h2>Groups</h2> | |||
<table> | |||
<thead> | |||
<tr> | |||
<th>Name</th> | |||
<th></th> | |||
</tr> | |||
<thead> | |||
<tbody> | |||
<?php foreach($_["groups"] as $group): ?> | |||
<form> | |||
<table> | |||
<thead> | |||
<tr> | |||
<td><?php echo $group["name"]; ?></td> | |||
<td>remove</td> | |||
<th>Name</th> | |||
<th></th> | |||
</tr> | |||
<?php endforeach; ?> | |||
</tbody> | |||
</table> | |||
<thead> | |||
<tbody> | |||
<?php foreach($_["groups"] as $group): ?> | |||
<tr> | |||
<td><?php echo $group["name"] ?></td> | |||
<td><a class="removegroup-button" href="">remove</a></td> | |||
</tr> | |||
<?php endforeach; ?> | |||
<tr> | |||
<td><input type="text" name="name" /></td> | |||
<td><input type="submit" /></td> | |||
</tr> | |||
</tbody> | |||
</table> | |||
</form> | |||
<a id="addgroup-button" href="">Add group</a> | |||
<div id="adduser-form" title="Add user"> | |||
<form> | |||
User name<br> | |||
<input type="text" name="name" /><br> | |||
Password<br> | |||
<input type="password" name="password" /> | |||
</form> | |||
</div> | |||
<div id="edituser-form" title="Force new password"> | |||
<form> | |||
New password for $user<br> | |||
<input type="password" name="password" /> | |||
</form> | |||
</div> | |||
<div id="removeuser-form" title="Remove user"> | |||
Do you really want to delete user $user? | |||
</div> | |||
<div id="removegroup-form" title="Remove Group"> | |||
Do you really want to delete group $group? | |||
</div> |
@@ -28,21 +28,24 @@ if( !OC_USER::isLoggedIn() || !OC_GROUP::inGroup( $_SESSION['user_id'], 'admin' | |||
exit(); | |||
} | |||
// We have some javascript foo! | |||
OC_UTIL::addScript( "admin", "users" ); | |||
$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 ); | |||
foreach( OC_GROUP::getUserGroups( $i ) as $userGroup ){ | |||
$ingroups[] = $userGroup; | |||
} | |||
$users[] = array( "name" => $i, "groups" => join( ",", $ingroups )); | |||
} | |||
foreach( OC_USER::getGroups() as $i ){ | |||
foreach( OC_GROUP::getGroups() as $i ){ | |||
// Do some more work here soon | |||
$groups[] = array( "name" => $i ); | |||
$groups[] = array( "name" => $i["gid"] ); | |||
} | |||
$tmpl = new OC_TEMPLATE( "admin", "users", "admin" ); |
@@ -24,8 +24,6 @@ | |||
require_once( 'lib/base.php' ); | |||
require_once( 'appconfig.php' ); | |||
require_once( 'template.php' ); | |||
var_dump( $_SESSION ); | |||
//exit; | |||
if( OC_USER::isLoggedIn()){ | |||
if( $_GET["logout"] ){ | |||
OC_USER::logout(); |
@@ -119,7 +119,7 @@ class OC_GROUP_DATABASE extends OC_GROUP_BACKEND { | |||
$groups = array(); | |||
while( $row = $result->fetchRow()){ | |||
$groups[] = $row; | |||
$groups[] = $row["gid"]; | |||
} | |||
return $groups; |