make log level configurable

This commit is contained in:
Robin Appelman 2011-10-16 21:08:44 +02:00
parent 820cd0fb75
commit d9372ac766
6 changed files with 39 additions and 7 deletions

View File

@ -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" ));
}
}

View File

@ -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);

View File

@ -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';
?>

5
settings/js/admin.js Normal file
View File

@ -0,0 +1,5 @@
$(document).ready(function(){
$('#loglevel').change(function(){
$.post(OC.filePath('settings','ajax','setloglevel.php'), { level: $(this).val() } );
})
});

View File

@ -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;
};?>
};?>
<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>

View File

@ -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">