diff options
-rw-r--r-- | lib/app.php | 5 | ||||
-rw-r--r-- | settings/admin.php | 2 | ||||
-rw-r--r-- | settings/ajax/setloglevel.php | 15 | ||||
-rw-r--r-- | settings/js/admin.js | 5 | ||||
-rw-r--r-- | settings/templates/admin.php | 17 | ||||
-rw-r--r-- | settings/templates/log.php | 2 |
6 files changed, 39 insertions, 7 deletions
diff --git a/lib/app.php b/lib/app.php index 51dcb8d5732..30ebcf032b3 100644 --- a/lib/app.php +++ b/lib/app.php @@ -225,10 +225,7 @@ class OC_App{ // admin log menu $settings[] = array( "id" => "core_log", "order" => 4, "href" => OC_Helper::linkTo( "settings", "log.php" ), "name" => $l->t("Log"), "icon" => OC_Helper::imagePath( "log", "apps.svg" )); - // if there're some admin forms - if(!empty(self::$adminForms)) - // admins menu - $settings[]=array( "id" => "admin", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "admin.php" ), "name" => $l->t("Admin"), "icon" => OC_Helper::imagePath( "settings", "admin.svg" )); + $settings[]=array( "id" => "admin", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "admin.php" ), "name" => $l->t("Admin"), "icon" => OC_Helper::imagePath( "settings", "admin.svg" )); } } diff --git a/settings/admin.php b/settings/admin.php index 81ed6aa9516..9ee79002b5e 100644 --- a/settings/admin.php +++ b/settings/admin.php @@ -9,10 +9,12 @@ require_once('../lib/base.php'); OC_Util::checkAdminUser(); OC_Util::addStyle( "settings", "settings" ); +OC_Util::addScript( "settings", "admin" ); OC_App::setActiveNavigationEntry( "admin" ); $tmpl = new OC_Template( 'settings', 'admin', 'user'); $forms=OC_App::getForms('admin'); +$tmpl->assign('loglevel',OC_Config::getValue( "loglevel", 2 )); $tmpl->assign('forms',array()); foreach($forms as $form){ $tmpl->append('forms',$form); diff --git a/settings/ajax/setloglevel.php b/settings/ajax/setloglevel.php new file mode 100644 index 00000000000..298cbd64738 --- /dev/null +++ b/settings/ajax/setloglevel.php @@ -0,0 +1,15 @@ +<?php +/** + * Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com> + * This file is licensed under the Affero General Public License version 3 or later. + * See the COPYING-README file. + */ + +require_once('../../lib/base.php'); +OC_Util::checkAdminUser(); + +OC_Config::setValue( 'loglevel', $_POST['level'] ); + +echo 'true'; + +?>
\ No newline at end of file diff --git a/settings/js/admin.js b/settings/js/admin.js new file mode 100644 index 00000000000..a3585f7e1c2 --- /dev/null +++ b/settings/js/admin.js @@ -0,0 +1,5 @@ +$(document).ready(function(){ + $('#loglevel').change(function(){ + $.post(OC.filePath('settings','ajax','setloglevel.php'), { level: $(this).val() } ); + }) +});
\ No newline at end of file diff --git a/settings/templates/admin.php b/settings/templates/admin.php index 98acd541e36..e3fd60fefce 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -2,8 +2,21 @@ * Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com> * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file. - */?> + */ +$levels=array('Debug','Info','Warning','Error','Fatal'); +?> <?php foreach($_['forms'] as $form){ echo $form; -};?>
\ No newline at end of file +};?> +<fieldset class="personalblock"> + <legend><strong><?php echo $l->t('Log level');?></strong></legend> + <select name='loglevel' id='loglevel'> + <option value='<?php echo $_['loglevel']?>'><?php echo $levels[$_['loglevel']]?></option> + <?php for($i=0;$i<5;$i++): + if($i!=$_['loglevel']):?> + <option value='<?php echo $i?>'><?php echo $levels[$i]?></option> + <?php endif; + endfor;?> + </select> +</fieldset> diff --git a/settings/templates/log.php b/settings/templates/log.php index 467f594186c..bcf5258f5f5 100644 --- a/settings/templates/log.php +++ b/settings/templates/log.php @@ -3,7 +3,7 @@ * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file. */ -$levels=array('DEBUG','INFO','WARN','ERROR','FATAL'); +$levels=array('Debug','Info','Warning','Error','Fatal'); ?> <div id="controls"> |