set_focus('tab', 'options', null);
if (!can_perform('canadmintools'))
{
admin_login();
}
// ###################################################################
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'modify';
}
// ###################################################################
if ($_REQUEST['do'] == 'kill')
{
$language = new LanguageAPI($bugsys);
$language->set('languageid', $bugsys->in['languageid']);
$language->set_condition();
$language->delete();
$admin->redirect('language.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'delete')
{
$admin->page_confirm(_('Are you sure you want to delete this language?'), 'language.php', 'kill', array('languageid' => $bugsys->input_clean('languageid', TYPE_UINT)));
}
// ###################################################################
if ($_POST['do'] == 'insert')
{
$language = new LanguageAPI($bugsys);
$language->set('title', $bugsys->in['title']);
$language->set('charset', $bugsys->in['charset']);
$language->set('direction', $bugsys->in['direction']);
$language->set('userselect', $bugsys->in['userselect']);
$language->set('langcode', $bugsys->in['langcode']);
$language->insert();
$admin->redirect('language.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'add')
{
NavLinks::languagesAdd();
$navigator->set_focus('link', 'options-languages-add', 'options-languages');
$admin->page_start(_('New Language'));
$admin->form_start('language.php', 'insert');
$admin->table_start();
$admin->table_head(_('New Language'));
$admin->row_input(_('Title'), 'title');
$admin->row_input(_('Gettext Language Code (language_COUNTRY)'), 'langcode');
$admin->row_input(_('Character Set'), 'charset', 'utf-8');
$admin->list_item(_('Left-to-Right'), 'ltr', true);
$admin->list_item(_('Right-to-Left'), 'rtl');
$admin->row_list(_('Direction'), 'direction');
$admin->row_yesno(_('User Selectable'), 'userselect', true);
$admin->row_submit();
$admin->table_end();
$admin->form_end();
$admin->page_end();
}
// ###################################################################
if ($_POST['do'] == 'update')
{
$language = new LanguageAPI($bugsys);
$language->set('languageid', $bugsys->in['languageid']);
$language->set_condition();
$language->set('title', $bugsys->in['title']);
$language->set('charset', $bugsys->in['charset']);
$language->set('direction', $bugsys->in['direction']);
$language->set('userselect', $bugsys->in['userselect']);
$language->set('langcode', $bugsys->in['langcode']);
$language->update();
$admin->redirect('language.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'edit')
{
NavLinks::languagesEdit($bugsys->in['languageid']);
$navigator->set_focus('link', 'options-languages-edit', 'options-languages');
$languageapi = new LanguageAPI($bugsys);
$languageapi->set('languageid', $bugsys->in['languageid']);
$languageapi->set_condition();
$languageapi->fetch();
$language =& $languageapi->objdata;
$admin->page_start(_('Edit Language'));
$admin->form_start('language.php', 'update');
$admin->table_start();
$admin->table_head(sprintf(_('Edit Language - %1$s'), $language['title']));
$admin->form_hidden_field('languageid', $language['languageid']);
$admin->row_input(_('Title'), 'title', $language['title']);
$admin->row_input(_('Gettext Language Code (language_COUNTRY)'), 'langcode', $language['langcode']);
$admin->row_input(_('Character Set'), 'charset', $language['charset']);
$admin->list_item(_('Left-to-Right'), 'ltr', (($language['direction'] == 'ltr') ? true : false));
$admin->list_item(_('Right-to-Left'), 'rtl', (($language['direction'] == 'rtl') ? true : false));
$admin->row_list(_('Direction'), 'direction');
$admin->row_yesno(_('User Selectable'), 'userselect', $language['userselect']);
$admin->row_submit();
$admin->table_end();
$admin->form_end();
$admin->page_end();
}
// ###################################################################
if ($_REQUEST['do'] == 'modify')
{
NavLinks::languagesAdd();
$navigator->set_focus('link', 'options-pages-languages', 'options-pages');
$admin->page_start(_('Manage Languages'));
$admin->table_start();
$admin->table_head(_('Manage Languages'), 3, 'language_manage');
$admin->table_column_head(array(_('Title'), _('Language Code / Charset'), _('Options')));
$languages = $db->query("SELECT * FROM " . TABLE_PREFIX . "language ORDER BY languageid ASC");
while ($language = $db->fetch_array($languages))
{
$admin->row_multi_item(array(
"$language[title]" => 'l',
$language['langcode'] . ' / ' . $language['charset'] => 'c',
(($bugsys->options['defaultlanguage'] == $language['languageid']) ? '' . _('DEFAULT LANGUAGE') . ' / ' : '') . ($language['userselect'] ? _('User Selectable') : _('Private')) => 'c'
));
}
$admin->table_end();
$admin->page_end();
}
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>