]>
src.bluestatic.org Git - bugdar.git/blob - admin/language.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 require_once ( './global.php' );
23 require_once ( './includes/api_language.php' );
25 require_once ( './includes/class_api_error.php' );
26 APIError ( array ( new API_Error_Handler ( $admin ), 'admin_error' ));
28 NavLinks
:: optionsPages ();
29 $navigator- > set_focus ( 'tab' , 'options' , null );
31 if (! can_perform ( 'canadmintools' ))
36 // ###################################################################
38 if ( empty ( $_REQUEST [ 'do' ]))
40 $_REQUEST [ 'do' ] = 'modify' ;
43 // ###################################################################
45 if ( $_REQUEST [ 'do' ] == 'kill' )
47 $language = new LanguageAPI ( $bugsys );
48 $language- > set ( 'languageid' , $bugsys- > in
[ 'languageid' ]);
49 $language- > set_condition ();
52 $admin- > redirect ( 'language.php?do=modify' );
55 // ###################################################################
57 if ( $_REQUEST [ 'do' ] == 'delete' )
59 $admin- > page_confirm ( _ ( 'Are you sure you want to delete this language?' ), 'language.php' , 'kill' , array ( 'languageid' => $bugsys- > input_clean ( 'languageid' , TYPE_UINT
)));
62 // ###################################################################
64 if ( $_POST [ 'do' ] == 'insert' )
66 $language = new LanguageAPI ( $bugsys );
67 $language- > set ( 'title' , $bugsys- > in
[ 'title' ]);
68 $language- > set ( 'charset' , $bugsys- > in
[ 'charset' ]);
69 $language- > set ( 'direction' , $bugsys- > in
[ 'direction' ]);
70 $language- > set ( 'userselect' , $bugsys- > in
[ 'userselect' ]);
71 $language- > set ( 'langcode' , $bugsys- > in
[ 'langcode' ]);
74 $admin- > redirect ( 'language.php?do=modify' );
77 // ###################################################################
79 if ( $_REQUEST [ 'do' ] == 'add' )
81 NavLinks
:: languagesAdd ();
82 $navigator- > set_focus ( 'link' , 'options-languages-add' , 'options-languages' );
84 $admin- > page_start ( _ ( 'New Language' ));
86 $admin- > form_start ( 'language.php' , 'insert' );
87 $admin- > table_start ();
88 $admin- > table_head ( _ ( 'New Language' ));
90 $admin- > row_input ( _ ( 'Title' ), 'title' );
91 $admin- > row_input ( _ ( 'Gettext Language Code (<em><a href="http://www.gnu.org/software/gettext/manual/html_chapter/gettext_15.html">language</a></em>_<em><a href="http://www.gnu.org/software/gettext/manual/html_chapter/gettext_16.html">COUNTRY</a></em>)' ), 'langcode' );
92 $admin- > row_input ( _ ( 'Character Set' ), 'charset' , 'utf-8' );
93 $admin- > list_item ( _ ( 'Left-to-Right' ), 'ltr' , true );
94 $admin- > list_item ( _ ( 'Right-to-Left' ), 'rtl' );
95 $admin- > row_list ( _ ( 'Direction' ), 'direction' );
96 $admin- > row_yesno ( _ ( 'User Selectable' ), 'userselect' , true );
105 // ###################################################################
107 if ( $_POST [ 'do' ] == 'update' )
109 $language = new LanguageAPI ( $bugsys );
110 $language- > set ( 'languageid' , $bugsys- > in
[ 'languageid' ]);
111 $language- > set_condition ();
112 $language- > set ( 'title' , $bugsys- > in
[ 'title' ]);
113 $language- > set ( 'charset' , $bugsys- > in
[ 'charset' ]);
114 $language- > set ( 'direction' , $bugsys- > in
[ 'direction' ]);
115 $language- > set ( 'userselect' , $bugsys- > in
[ 'userselect' ]);
116 $language- > set ( 'langcode' , $bugsys- > in
[ 'langcode' ]);
119 $admin- > redirect ( 'language.php?do=modify' );
122 // ###################################################################
124 if ( $_REQUEST [ 'do' ] == 'edit' )
126 NavLinks
:: languagesEdit ( $bugsys- > in
[ 'languageid' ]);
127 $navigator- > set_focus ( 'link' , 'options-languages-edit' , 'options-languages' );
129 $languageapi = new LanguageAPI ( $bugsys );
130 $languageapi- > set ( 'languageid' , $bugsys- > in
[ 'languageid' ]);
131 $languageapi- > set_condition ();
132 $languageapi- > fetch ();
134 $language =& $languageapi- > objdata
;
136 $admin- > page_start ( _ ( 'Edit Language' ));
138 $admin- > form_start ( 'language.php' , 'update' );
139 $admin- > table_start ();
140 $admin- > table_head ( sprintf ( _ ( 'Edit Language - %1 $s' ), $language [' title
']));
142 $admin- >form_hidden_field(' languageid
', $language [' languageid
']);
144 $admin- >row_input(_(' Title
'), ' title
', $language [' title
']);
145 $admin- >row_input(_(' Gettext Language
Code (< em
>< a href
= "http://www.gnu.org/software/gettext/manual/html_chapter/gettext_15.html" > language
</ a
></ em
> _
< em
>< a href
= "http://www.gnu.org/software/gettext/manual/html_chapter/gettext_16.html" > COUNTRY
</ a
></ em
>) '), ' langcode
', $language [' langcode
']);
146 $admin- >row_input(_(' Character Set
'), ' charset
', $language [' charset
']);
147 $admin- >list_item(_(' Left
- to
- Right
'), ' ltr
', (( $language [' direction
'] == ' ltr
') ? true : false));
148 $admin- >list_item(_(' Right
- to
- Left
'), ' rtl
', (( $language [' direction
'] == ' rtl
') ? true : false));
149 $admin- >row_list(_(' Direction
'), ' direction
');
150 $admin- >row_yesno(_(' User Selectable
'), ' userselect
', $language [' userselect
']);
152 $admin- >row_submit();
159 // ###################################################################
161 if ( $_REQUEST [' do '] == ' modify
')
163 NavLinks::languagesAdd();
164 $navigator- >set_focus(' link
', ' options
- pages
- languages
', ' options
- pages
');
166 $admin- >page_start(_(' Manage Languages
'));
168 $admin- >table_start();
169 $admin- >table_head(_(' Manage Languages
'), 3, ' language_manage
');
171 $admin- >table_column_head(array(_(' Title
'), _(' Language Code
/ Charset
'), _(' Options
')));
173 $languages = $db- >query("SELECT * FROM " . TABLE_PREFIX . "language ORDER BY languageid ASC");
174 while ( $language = $db- >fetch_array( $languages ))
176 $admin- >row_multi_item(array(
177 "<a href= \" language.php?do=edit&languageid= $language [languageid] \" > $language [title]</a>" => ' l
',
178 $language [' langcode
'] . ' / ' . $language [' charset
'] => ' c
',
179 (( $bugsys- >options[' defaultlanguage
'] == $language [' languageid
']) ? ' < strong
> ' . _(' DEFAULT LANGUAGE
') . ' </ strong
> / ' : ' ') . ( $language [' userselect
'] ? _(' User Selectable
') : _(' Private ')) => ' c
'
188 /*=====================================================================*\
189 || ###################################################################
192 || ###################################################################
193 \*=====================================================================*/