2001-07-30 18:05:42 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
2004-01-27 21:49:25 +01:00
|
|
|
* eGroupWare - Setup *
|
|
|
|
* http://www.egroupware.org *
|
2001-07-30 18:05:42 +02:00
|
|
|
* -------------------------------------------- *
|
|
|
|
* 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$ */
|
|
|
|
|
2005-03-04 13:40:28 +01:00
|
|
|
$GLOBALS['egw_info'] = array(
|
|
|
|
'flags' => array(
|
|
|
|
'noheader' => True,
|
|
|
|
'nonavbar' => True,
|
|
|
|
'currentapp' => 'home',
|
|
|
|
'noapi' => True
|
|
|
|
));
|
2003-10-04 15:24:34 +02:00
|
|
|
include('./inc/functions.inc.php');
|
|
|
|
// Authorize the user to use setup app and load the database
|
|
|
|
// Does not return unless user is authorized
|
2005-03-04 13:40:28 +01:00
|
|
|
if (!$GLOBALS['egw_setup']->auth('Config') || @$_POST['cancel'])
|
2001-07-30 18:05:42 +02:00
|
|
|
{
|
2003-10-04 15:24:34 +02:00
|
|
|
Header('Location: index.php');
|
|
|
|
exit;
|
|
|
|
}
|
2005-03-04 13:40:28 +01:00
|
|
|
$GLOBALS['egw_setup']->loaddb();
|
2002-09-16 01:21:01 +02:00
|
|
|
|
2003-10-04 15:24:34 +02:00
|
|
|
if (@$_POST['submit'])
|
|
|
|
{
|
2005-03-04 13:40:28 +01:00
|
|
|
$GLOBALS['egw_setup']->translation->setup_translation_sql();
|
|
|
|
$GLOBALS['egw_setup']->translation->sql->install_langs(@$_POST['lang_selected'],@$_POST['upgrademethod']);
|
2003-10-04 15:24:34 +02:00
|
|
|
|
2004-07-31 18:19:48 +02:00
|
|
|
|
2005-03-04 13:40:28 +01:00
|
|
|
if( !$GLOBALS['egw_setup']->translation->sql->line_rejected )
|
2004-07-31 18:19:48 +02:00
|
|
|
{
|
|
|
|
Header('Location: index.php');
|
|
|
|
exit;
|
|
|
|
}
|
2001-07-30 18:05:42 +02:00
|
|
|
}
|
|
|
|
|
2005-03-04 13:40:28 +01:00
|
|
|
$tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup');
|
2003-10-04 15:24:34 +02:00
|
|
|
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
|
|
|
|
$setup_tpl->set_file(array(
|
|
|
|
'T_head' => 'head.tpl',
|
|
|
|
'T_footer' => 'footer.tpl',
|
|
|
|
'T_alert_msg' => 'msg_alert_msg.tpl',
|
|
|
|
'T_lang_main' => 'lang_main.tpl'
|
|
|
|
));
|
|
|
|
|
|
|
|
$setup_tpl->set_block('T_lang_main','B_choose_method','V_choose_method');
|
|
|
|
|
|
|
|
$stage_title = lang('Multi-Language support setup');
|
2003-12-19 13:34:45 +01:00
|
|
|
$stage_desc = lang('This program will help you upgrade or install different languages for eGroupWare');
|
2003-10-04 15:24:34 +02:00
|
|
|
$tbl_width = @$newinstall ? '60%' : '80%';
|
|
|
|
$td_colspan = @$newinstall ? '1' : '2';
|
|
|
|
$td_align = @$newinstall ? ' align="center"' : '';
|
2005-07-11 20:02:19 +02:00
|
|
|
$hidden_var1 = @$newinstall ? '<input type="hidden" name="newinstall" value="True" />' : '';
|
2003-10-04 15:24:34 +02:00
|
|
|
|
2005-03-04 13:40:28 +01:00
|
|
|
if (!@$newinstall && !isset($GLOBALS['egw_info']['setup']['installed_langs']))
|
2003-04-02 19:46:37 +02:00
|
|
|
{
|
2005-03-04 13:40:28 +01:00
|
|
|
$GLOBALS['egw_setup']->detection->check_lang(false); // get installed langs
|
2003-04-02 19:46:37 +02:00
|
|
|
}
|
2003-10-04 15:24:34 +02:00
|
|
|
$select_box_desc = lang('Select which languages you would like to use');
|
|
|
|
$select_box = '';
|
2004-07-10 12:59:37 +02:00
|
|
|
$languages = get_langs();
|
|
|
|
uasort($languages,create_function('$a,$b','return strcmp(@$a[\'descr\'],@$b[\'descr\']);'));
|
|
|
|
foreach($languages as $id => $data)
|
2001-07-30 18:05:42 +02:00
|
|
|
{
|
2003-10-04 15:24:34 +02:00
|
|
|
$select_box_langs =
|
|
|
|
@$select_box_langs
|
|
|
|
.'<option value="' . $id . '"'
|
2005-07-11 20:02:19 +02:00
|
|
|
.(@$GLOBALS['egw_info']['setup']['installed_langs'][$id]?' selected="selected"':'').'>'
|
2004-06-13 23:31:21 +02:00
|
|
|
. $data['descr'] . '</option>'
|
2003-10-04 15:24:34 +02:00
|
|
|
."\n";
|
|
|
|
}
|
2001-07-30 18:05:42 +02:00
|
|
|
|
2003-10-04 15:24:34 +02:00
|
|
|
if (!@$newinstall)
|
|
|
|
{
|
|
|
|
$meth_desc = lang('Select which method of upgrade you would like to do');
|
|
|
|
$blurb_addonlynew = lang('Only add languages that are not in the database already');
|
|
|
|
$blurb_addmissing = lang('Only add new phrases');
|
|
|
|
$blurb_dumpold = lang('Delete all old languages and install new ones');
|
|
|
|
|
|
|
|
$setup_tpl->set_var('meth_desc',$meth_desc);
|
|
|
|
$setup_tpl->set_var('blurb_addonlynew',$blurb_addonlynew);
|
|
|
|
$setup_tpl->set_var('blurb_addmissing',$blurb_addmissing);
|
|
|
|
$setup_tpl->set_var('blurb_dumpold',$blurb_dumpold);
|
2004-07-31 18:19:48 +02:00
|
|
|
$setup_tpl->set_var('lang_debug',lang('enable for extra debug-messages'));
|
2003-10-04 15:24:34 +02:00
|
|
|
$setup_tpl->parse('V_choose_method','B_choose_method');
|
2001-07-30 18:05:42 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-10-04 15:24:34 +02:00
|
|
|
$setup_tpl->set_var('V_choose_method','');
|
2001-07-30 18:05:42 +02:00
|
|
|
}
|
2003-10-04 15:24:34 +02:00
|
|
|
|
2004-07-31 18:19:48 +02:00
|
|
|
// Rejected Lines
|
2005-03-04 13:40:28 +01:00
|
|
|
if($_POST['debug'] && count($GLOBALS['egw_setup']->translation->sql->line_rejected))
|
2004-07-31 18:19:48 +02:00
|
|
|
{
|
|
|
|
$str = '';
|
2005-03-04 13:40:28 +01:00
|
|
|
foreach($GLOBALS['egw_setup']->translation->sql->line_rejected as $badline)
|
2004-07-31 18:19:48 +02:00
|
|
|
{
|
|
|
|
$_f_buffer = split("[/\\]", $badline['appfile']);
|
|
|
|
$str .= lang('Application: %1, File: %2, Line: "%3"','<b>'.$_f_buffer[count($_f_buffer)-3].'</b>',
|
2005-07-11 20:02:19 +02:00
|
|
|
'<b>'.$_f_buffer[count($_f_buffer)-1].'</b>',$badline['line'])."<br />\n";
|
2004-07-31 18:19:48 +02:00
|
|
|
}
|
|
|
|
$setup_tpl->set_var('V_alert_word', lang('Rejected lines'));
|
|
|
|
$setup_tpl->set_var('V_alert_msg', $str);
|
|
|
|
$alert = TRUE;
|
|
|
|
}
|
|
|
|
|
2003-10-04 15:24:34 +02:00
|
|
|
$setup_tpl->set_var('stage_title',$stage_title);
|
|
|
|
$setup_tpl->set_var('stage_desc',$stage_desc);
|
|
|
|
$setup_tpl->set_var('tbl_width',$tbl_width);
|
|
|
|
$setup_tpl->set_var('td_colspan',$td_colspan);
|
|
|
|
$setup_tpl->set_var('td_align',$td_align);
|
|
|
|
$setup_tpl->set_var('hidden_var1',$hidden_var1);
|
|
|
|
$setup_tpl->set_var('select_box_desc',$select_box_desc);
|
|
|
|
$setup_tpl->set_var('select_box_langs',$select_box_langs);
|
|
|
|
|
|
|
|
$setup_tpl->set_var('lang_install',lang('install'));
|
|
|
|
$setup_tpl->set_var('lang_cancel',lang('cancel'));
|
|
|
|
|
2005-03-04 13:40:28 +01:00
|
|
|
$GLOBALS['egw_setup']->html->show_header("$stage_title",False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')');
|
2003-10-04 15:24:34 +02:00
|
|
|
$setup_tpl->pparse('out','T_lang_main');
|
2004-07-31 18:19:48 +02:00
|
|
|
|
|
|
|
if($alert)
|
|
|
|
$setup_tpl->pparse('out','T_alert_msg');
|
|
|
|
|
2005-03-04 13:40:28 +01:00
|
|
|
$GLOBALS['egw_setup']->html->show_footer();
|
2001-07-30 18:05:42 +02:00
|
|
|
?>
|