From 7ac7a6801ce867a20c4b36950d5929e577915871 Mon Sep 17 00:00:00 2001 From: Kamil Domanski Date: Mon, 20 Jun 2011 18:16:24 +0200 Subject: [PATCH] added basic "installed apps" page --- admin/appinfo/app.php | 2 +- admin/apps.php | 99 ++++++++++++++++++++---------------- admin/css/apps.css | 18 +++++++ admin/templates/appsinst.php | 27 ++++++++++ 4 files changed, 100 insertions(+), 46 deletions(-) create mode 100644 admin/templates/appsinst.php diff --git a/admin/appinfo/app.php b/admin/appinfo/app.php index 775575e22a..d01b7d5d62 100644 --- a/admin/appinfo/app.php +++ b/admin/appinfo/app.php @@ -7,6 +7,6 @@ OC_APP::addAdminPage( array( "id" => "core_users", "order" => 2, "href" => OC_HE OC_APP::addAdminPage( array( "id" => "core_apps", "order" => 3, "href" => OC_HELPER::linkTo( "admin", "apps.php" ), "name" => "Apps", "icon" => OC_HELPER::imagePath( "admin", "apps.png" ))); // Add subentries for App installer -OC_APP::addNavigationSubEntry( "core_apps", array( "id" => "core_apps_installed", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php?add=some¶meters=here" ), "name" => "Installed apps", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); +OC_APP::addNavigationSubEntry( "core_apps", array( "id" => "core_apps_installed", "order" => 4, "href" => OC_HELPER::linkTo( "admin", "apps.php?installed" ), "name" => "Installed apps", "icon" => OC_HELPER::imagePath( "admin", "navicon.png" ))); ?> diff --git a/admin/apps.php b/admin/apps.php index 5b4e65e340..725128a752 100644 --- a/admin/apps.php +++ b/admin/apps.php @@ -34,65 +34,74 @@ OC_UTIL::addStyle( "admin", "apps" ); if(isset($_GET['id'])) $id=$_GET['id']; else $id=0; if(isset($_GET['cat'])) $cat=$_GET['cat']; else $cat=0; +if(isset($_GET['installed'])) $installed=true; else $installed=false; -$categories=OC_OCSCLIENT::getCategories(); -if($categories==NULL){ - OC_APP::setActiveNavigationEntry( "core_apps" ); +if($installed){ + global $SERVERROOT; + $apps = OC_APPCONFIG::getApps(); + $records = array(); - $tmpl = new OC_TEMPLATE( "admin", "app_noconn", "admin" ); + 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, + 'name' => $info['name'], + 'version' => $info['version'], + 'author' => $info['author'], + 'enabled' => OC_APP::isEnabled( $app )); + $records[]=$record; + } + + $tmpl = new OC_TEMPLATE( "admin", "appsinst", "admin" ); + $tmpl->assign( "apps", $records ); $tmpl->printPage(); unset($tmpl); exit(); -} -/* +}else{ -All -Installed Apps + $categories=OC_OCSCLIENT::getCategories(); + if($categories==NULL){ + OC_APP::setActiveNavigationEntry( "core_apps" ); - - -foreach($categories as $key=>$value) { -print_r($value); -} - - -*/ - -// OC_APP::setActiveNavigationEntry( "core_apps_installed" ); - - -if($id==0) { - OC_APP::setActiveNavigationEntry( "core_apps" ); - - if($cat==0){ - $numcats=array(); - foreach($categories as $key=>$value) $numcats[]=$key; - $apps=OC_OCSCLIENT::getApplications($numcats); - }else{ - $apps=OC_OCSCLIENT::getApplications($cat); + $tmpl = new OC_TEMPLATE( "admin", "app_noconn", "admin" ); + $tmpl->printPage(); + unset($tmpl); + exit(); } - // return template - $tmpl = new OC_TEMPLATE( "admin", "apps", "admin" ); - $tmpl->assign( "categories", $categories ); - $tmpl->assign( "apps", $apps ); - $tmpl->printPage(); - unset($tmpl); + if($id==0) { + OC_APP::setActiveNavigationEntry( "core_apps" ); -}else{ - OC_APP::setActiveNavigationEntry( "core_apps" ); + if($cat==0){ + $numcats=array(); + foreach($categories as $key=>$value) $numcats[]=$key; + $apps=OC_OCSCLIENT::getApplications($numcats); + }else{ + $apps=OC_OCSCLIENT::getApplications($cat); + } - $app=OC_OCSCLIENT::getApplication($id); + // return template + $tmpl = new OC_TEMPLATE( "admin", "apps", "admin" ); - $tmpl = new OC_TEMPLATE( "admin", "app", "admin" ); - $tmpl->assign( "categories", $categories ); - $tmpl->assign( "app", $app ); - $tmpl->printPage(); - unset($tmpl); + $tmpl->assign( "categories", $categories ); + $tmpl->assign( "apps", $apps ); + $tmpl->printPage(); + unset($tmpl); + }else{ + OC_APP::setActiveNavigationEntry( "core_apps" ); + + $app=OC_OCSCLIENT::getApplication($id); + + $tmpl = new OC_TEMPLATE( "admin", "app", "admin" ); + $tmpl->assign( "categories", $categories ); + $tmpl->assign( "app", $app ); + $tmpl->printPage(); + unset($tmpl); + + } } - ?> - diff --git a/admin/css/apps.css b/admin/css/apps.css index 7063762204..fbbd4fce4b 100644 --- a/admin/css/apps.css +++ b/admin/css/apps.css @@ -7,6 +7,24 @@ table td.date text-align: right; } +table td.version, table td.enabled, table td.disabled +{ + padding: 0.5em 1em; + text-align: center; +} + +table td.enabled +{ + color: #006600; + font-weight: bold; +} + +table td.disabled +{ + color: #660000; + font-weight: bold; +} + .preview { padding: 3px; diff --git a/admin/templates/appsinst.php b/admin/templates/appsinst.php new file mode 100644 index 0000000000..c1acc09d5d --- /dev/null +++ b/admin/templates/appsinst.php @@ -0,0 +1,27 @@ + +

t( 'Installed Applications' ); ?>

+ + + + + + + + + + + + + + + + + + + + +
t( 'Name' ); ?>t( 'Version' ); ?>t( 'Author' ); ?>t( 'Status' ); ?>
t( $app['enabled'] ? 'enabled' : 'disabled' ); ?>
\ No newline at end of file