2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
14 define('AT_INCLUDE_PATH', '../../../include/');
15 require(AT_INCLUDE_PATH.'vitals.inc.php');
16 admin_authenticate(AT_ADMIN_PRIV_LANGUAGES);
17 if (!AT_DEVEL_TRANSLATE) { exit; }
19 require_once(AT_INCLUDE_PATH . '../mods/_core/languages/classes/LanguageEditor.class.php');
21 $lang = $languageManager->getLanguage($_GET['lang_code']);
22 if ($lang === FALSE) {
23 require(AT_INCLUDE_PATH.'header.inc.php');
24 echo '<h3>'._AT('edit_language').'</h3>';
25 $msg->addError('NO_LANGUAGE');
29 require(AT_INCLUDE_PATH.'footer.inc.php');
33 if (isset($_POST['cancel'])) {
34 $msg->addFeedback('CANCELLED');
35 header('Location: language.php');
37 } else if (isset($_POST['submit'])) {
38 $languageEditor = new LanguageEditor($_GET['lang_code']);
39 $state = $languageEditor->updateLanguage($_POST, $languageManager->exists($_POST['code'], $_POST['locale']));
41 if (!$msg->containsErrors() && $state !== FALSE) {
42 $msg->addFeedback('LANG_UPDATED');
43 header('Location: language.php');
48 require(AT_INCLUDE_PATH.'header.inc.php');
53 if (!isset($_POST['submit'])) {
54 $_POST['code'] = $lang->getParentCode();
55 $_POST['locale'] = $lang->getLocale();
56 $_POST['charset'] = $lang->getCharacterSet();
57 $_POST['direction'] = $lang->getDirection();
58 $_POST['reg_exp'] = $lang->getRegularExpression();
59 $_POST['native_name'] = $lang->getNativeName();
60 $_POST['english_name'] = $lang->getEnglishName();
65 <form method="post" action="<?php echo $_SERVER['PHP_SELF'] . '?lang_code=' . $_GET['lang_code']; ?>">
67 <input type="hidden" name="old_code" value="<?php echo $lang->getCode(); ?>" />
69 <div class="input-form" style="width:95%">
71 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="code"><?php echo _AT('lang_code'); ?></label><br />
72 <input id="code" name="code" type="text" size="2" maxlength="2" class="formfield" value="<?php echo $_POST['code']; ?>" />
76 <label for="locale"><?php echo _AT('locale'); ?></label><br />
77 <input id="locale" name="locale" type="text" size="2" maxlength="2" class="formfield" value="<?php echo $_POST['locale']; ?>" />
81 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="charset"><?php echo _AT('charset'); ?></label><br />
82 <input id="charset" name="charset" type="text" size="31" maxlength="20" class="formfield" value="<?php echo $_POST['charset']; ?>" />
86 <label for="ltr"><?php echo _AT('direction'); ?></label><br />
88 if ($_POST['direction'] == 'rtl') {
89 $rtl = 'checked="checked"';
93 $ltr='checked="checked"';
96 <input id="ltr" name="direction" type="radio" value="ltr" <?php echo $ltr; ?> /><label for="ltr"><?php echo _AT('ltr'); ?></label>, <input id="rtl" name="direction" type="radio" value="rtl" <?php echo $rtl; ?> /><label for="rtl"><?php echo _AT('rtl'); ?></label>
100 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="reg_exp"><?php echo _AT('reg_exp'); ?></label><br />
101 <input id="reg_exp" name="reg_exp" type="text" size="31" class="formfield" value="<?php echo $_POST['reg_exp']; ?>" />
105 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="nname"><?php echo _AT('name_in_language'); ?></label><br />
106 <input id="nname" name="native_name" type="text" size="31" maxlength="20" class="formfield" value="<?php echo $_POST['native_name']; ?>" />
110 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="ename"><?php echo _AT('name_in_english'); ?></label><br />
111 <input id="ename" name="english_name" type="text" size="31" maxlength="20" class="formfield" value="<?php echo $_POST['english_name'];?>" />
115 <div class="row buttons">
116 <input type="submit" name="submit" value="<?php echo _AT('submit'); ?>" /> <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
121 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>