support for the old format of the hook_settings file, as asked by Regis Leroy

This commit is contained in:
Ralf Becker 2005-07-30 08:12:13 +00:00
parent 183444dfbe
commit b8eabd7697
2 changed files with 132 additions and 6 deletions

View File

@ -37,7 +37,21 @@
{
$GLOBALS['egw']->redirect_link('/preferences/index.php');
}
if (substr($_SERVER['PHP_SELF'],-15) == 'preferences.php')
{
$pref_link = '/preferences/preferences.php';
$link_params = array(
'appname' => $_GET['appname'],
);
}
else
{
$pref_link = '/index.php';
$link_params = array(
'menuaction' => 'preferences.uisettings.index',
'appname' => $_GET['appname'],
);
}
$user = get_var('user',Array('POST'));
$forced = get_var('forced',Array('POST'));
$default = get_var('default',Array('POST'));
@ -118,11 +132,11 @@
// changes for the admin itself, should have immediate feedback ==> redirect
if(!$error && ($_POST['save'] || $_POST['apply']) && $GLOBALS['type'] == 'user' && $_GET['appname'] == 'preferences')
{
$GLOBALS['egw']->redirect_link('/index.php','menuaction=preferences.uisettings.index&appname=' . $_GET['appname']);
$GLOBALS['egw']->redirect_link($pref_link,$link_params);
}
$this->t->set_var('messages',$error);
$this->t->set_var('action_url',$GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $_GET['appname']));
$this->t->set_var('action_url',$GLOBALS['egw']->link($pref_link,$link_params));
$this->t->set_var('th_bg', $GLOBALS['egw_info']['theme']['th_bg']);
$this->t->set_var('th_text',$GLOBALS['egw_info']['theme']['th_text']);
$this->t->set_var('row_on', $GLOBALS['egw_info']['theme']['row_on']);
@ -238,15 +252,15 @@
{
$tabs[] = array(
'label' => lang('Your preferences'),
'link' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $_GET['appname'] . "&type=user")
'link' => $GLOBALS['egw']->link($pref_link,$link_params+array('type'=>'user')),
);
$tabs[] = array(
'label' => lang('Default preferences'),
'link' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $_GET['appname'] . "&type=default")
'link' => $GLOBALS['egw']->link($pref_link,$link_params+array('type'=>'default')),
);
$tabs[] = array(
'label' => lang('Forced preferences'),
'link' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname=' . $_GET['appname'] . "&type=forced")
'link' => $GLOBALS['egw']->link($pref_link,$link_params+array('type'=>'forced')),
);
switch($GLOBALS['type'])

112
preferences/preferences.php Executable file
View File

@ -0,0 +1,112 @@
<?php
/**************************************************************************\
* phpGroupWare - Preferences *
* http://www.phpgroupware.org *
* Written by RalfBecker@outdoor-training.de to emulate the old preferences *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
$GLOBALS['egw_info']['flags'] = array(
'noheader' => True,
'noappheader' => True,
'nonavbar' => True,
'currentapp' => 'preferences',
'enable_nextmatchs_class' => True,
);
include('../header.inc.php');
function create_section($title)
{
$GLOBALS['settings'][] = array(
'admin' => true, // admin is controlled by the old-format hook_settings file itself
'xmlrpc' => true, // make everything availible via xmlrpc
'title' => $title,
'type' => 'section',
);
}
function create_input_box($label,$name,$help='',$default='',$size='',$maxsize='',$type='',$run_lang=True)
{
$GLOBALS['settings'][$name] = array(
'admin' => true, // admin is controlled by the old-format hook_settings file itself
'xmlrpc' => true, // make everything availible via xmlrpc
'type' => 'input',
);
foreach(array('label','name','help','default','size','maxsize','type','run_lang','rows','cols','values','subst_help') as $var)
{
if (isset($$var)) $GLOBALS['settings'][$name][$var] = $$var;
}
}
function create_password_box($label,$name,$help='',$size='',$maxsize='',$run_lang=True)
{
$GLOBALS['settings'][$name] = array(
'admin' => true, // admin is controlled by the old-format hook_settings file itself
'xmlrpc' => true, // make everything availible via xmlrpc
'type' => 'password',
);
foreach(array('label','name','help','default','size','maxsize','type','run_lang','rows','cols','values','subst_help') as $var)
{
if (isset($$var)) $GLOBALS['settings'][$name][$var] = $$var;
}
}
function create_text_area($label,$name,$rows,$cols,$help='',$default='',$run_lang=True)
{
$GLOBALS['settings'][$name] = array(
'admin' => true, // admin is controlled by the old-format hook_settings file itself
'xmlrpc' => true, // make everything availible via xmlrpc
'type' => 'text',
);
foreach(array('label','name','help','default','size','maxsize','type','run_lang','rows','cols','values','subst_help') as $var)
{
if (isset($$var)) $GLOBALS['settings'][$name][$var] = $$var;
}
}
function create_select_box($label,$name,$values,$help='',$default='',$run_lang=True)
{
$GLOBALS['settings'][$name] = array(
'admin' => true, // admin is controlled by the old-format hook_settings file itself
'xmlrpc' => true, // make everything availible via xmlrpc
'type' => 'select',
);
foreach(array('label','name','help','default','size','maxsize','type','run_lang','rows','cols','values','subst_help') as $var)
{
if (isset($$var)) $GLOBALS['settings'][$name][$var] = $$var;
}
}
function create_check_box($label,$name,$help='',$default='',$run_lang=True)
{
$GLOBALS['settings'][$name] = array(
'admin' => true, // admin is controlled by the old-format hook_settings file itself
'xmlrpc' => true, // make everything availible via xmlrpc
'type' => 'check',
);
foreach(array('label','name','help','default','size','maxsize','type','run_lang','rows','cols','values','subst_help') as $var)
{
if (isset($$var)) $GLOBALS['settings'][$name][$var] = $$var;
}
}
function create_notify($label,$name,$rows,$cols,$help='',$default='',$values='',$subst_help=True,$run_lang=True)
{
$GLOBALS['settings'][$name] = array(
'admin' => true, // admin is controlled by the old-format hook_settings file itself
'xmlrpc' => true, // make everything availible via xmlrpc
'type' => 'notify',
);
foreach(array('label','name','help','default','size','maxsize','type','run_lang','rows','cols','values','subst_help') as $var)
{
if (isset($$var)) $GLOBALS['settings'][$name][$var] = $$var;
}
}
ExecMethod('preferences.uisettings.index');