1+ <?php
2+ // $Id: langform.inc.php 9954 2012-07-31 10:13:35Z beckmi $
3+ // ------------------------------------------------------------------------ //
4+ // Xlanguage: eXtensible Language Management For Xoops //
5+ // Copyright (c) 2004 Xoops China Community //
6+ // <http://www.xoops.org.cn/> //
7+ // ------------------------------------------------------------------------ //
8+ // This program is free software; you can redistribute it and/or modify //
9+ // it under the terms of the GNU General Public License as published by //
10+ // the Free Software Foundation; either version 2 of the License, or //
11+ // (at your option) any later version. //
12+ // //
13+ // You may not change or alter any portion of this comment or credits //
14+ // of supporting developers from this source code or any supporting //
15+ // source code which is considered copyrighted (c) material of the //
16+ // original comment or credit authors. //
17+ // //
18+ // This program is distributed in the hope that it will be useful, //
19+ // but WITHOUT ANY WARRANTY; without even the implied warranty of //
20+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
21+ // GNU General Public License for more details. //
22+ // //
23+ // You should have received a copy of the GNU General Public License //
24+ // along with this program; if not, write to the Free Software //
25+ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
26+ // ------------------------------------------------------------------------ //
27+ // Author: D.J.(phppp) php_pp@hotmail.com //
28+ // URL: http://www.xoops.org.cn //
29+ // ------------------------------------------------------------------------- //
30+
31+ include XOOPS_ROOT_PATH ."/class/xoopsformloader.php " ;
32+ $ sform = new XoopsThemeForm (_AM_XLANG_EDITLANG , "langform " , xoops_getenv ('PHP_SELF ' ));
33+
34+ if ($ isBase ){
35+ $ lang_select = new XoopsFormSelect (_AM_XLANG_NAME , 'lang_name ' , $ lang_name );
36+ $ lang_select ->addOptionArray ($ xlanguage_handler ->getXoopsLangList ());
37+ $ sform ->addElement ($ lang_select , true );
38+ }else {
39+ $ sform ->addElement (new XoopsFormText (_AM_XLANG_NAME , 'lang_name ' , 50 , 255 , $ lang_name ), true );
40+ }
41+
42+ $ sform ->addElement (new XoopsFormText (_AM_XLANG_DESC , 'lang_desc ' , 50 , 255 , $ lang_desc ));
43+
44+ //$sform->addElement(new XoopsFormText(_AM_XLANG_CODE, 'lang_code', 50, 255, $lang_code), true);
45+ $ lang_code = new XoopsFormText (_AM_XLANG_CODE , 'lang_code ' , 50 , 255 , $ lang_code );
46+ $ lang_code ->setDescription (_AM_XLANG_CODE_DESC );
47+ $ sform ->addElement ($ lang_code , true );
48+
49+
50+ //$sform->addElement(new XoopsFormText(_AM_XLANG_CHARSET, 'lang_charset', 50, 255, $lang_charset), true);
51+ $ lang_charset = new XoopsFormText (_AM_XLANG_CHARSET , 'lang_charset ' , 50 , 255 , $ lang_charset );
52+ $ lang_charset ->setDescription (_AM_XLANG_CHARSET_DESC );
53+ $ sform ->addElement ($ lang_charset , true );
54+
55+
56+ if (!$ isBase ){
57+ $ baseList =& $ xlanguage_handler ->getAll ();
58+ $ base_list = array ();
59+ foreach ($ baseList as $ base => $ baselang ){
60+ $ base_list [$ base ] = $ base ;
61+ }
62+
63+ $ base_select = new XoopsFormSelect (_AM_XLANG_BASE , 'lang_base ' , $ lang_base );
64+ $ base_select ->addOptionArray ($ base_list );
65+ $ sform ->addElement ($ base_select , true );
66+ }
67+ $ sform ->addElement (new XoopsFormText (_AM_XLANG_WEIGHT , 'weight ' , 10 , 10 , $ weight ));
68+
69+ $ image_option_tray = new XoopsFormElementTray (_AM_XLANG_IMAGE , '' );
70+ $ image_array =& XoopsLists::getImgListAsArray (XOOPS_ROOT_PATH . "/modules/ " . $ xoopsModule -> dirname () . "/images/ " );
71+ $ lang_image =(empty ($ lang_image ))?'noflag.gif ' :$ lang_image ;
72+ $ image_select = new XoopsFormSelect ('' , 'lang_image ' , $ lang_image );
73+ $ image_select ->addOptionArray ($ image_array );
74+ $ image_select ->setExtra ("onchange='showImgSelected( \"image \", \"lang_image \", \"/modules/ " . $ xoopsModule -> dirname () . "/images/ \", \"\", \"" . XOOPS_URL . "\")' " );
75+ $ image_tray = new XoopsFormElementTray ('' , ' ' );
76+ $ image_tray ->addElement ($ image_select );
77+ if (!empty ($ lang_image )){
78+ $ image_tray ->addElement (new XoopsFormLabel ('' , "<div style='padding: 8px;'><img src=' " . XOOPS_URL . "/modules/ " . $ xoopsModule -> dirname () . "/images/ " . $ lang_image . "' name='image' id='image' alt='' /></div> " ));
79+ }else {
80+ $ image_tray ->addElement (new XoopsFormLabel ('' , "<div style='padding: 8px;'><img src=' " . XOOPS_URL . "/images/blank.gif' name='image' id='image' alt='' /></div> " ));
81+ }
82+ $ image_option_tray ->addElement ($ image_tray );
83+ $ sform ->addElement ($ image_option_tray );
84+
85+ if (isset ($ lang_id )) $ sform ->addElement (new XoopsFormHidden ('lang_id ' , $ lang_id ));
86+ $ sform ->addElement (new XoopsFormHidden ('type ' , $ type ));
87+
88+ $ button_tray = new XoopsFormElementTray ('' , '' );
89+ $ button_tray ->addElement (new XoopsFormHidden ('op ' , 'save ' ));
90+ $ button_tray ->addElement (new XoopsFormButton ('' , '' , _SUBMIT , 'submit ' ));
91+ $ button_tray ->addElement (new XoopsFormButton ('' , '' , _CANCEL , 'submit ' ));
92+ $ sform ->addElement ($ button_tray );
93+
94+ $ sform ->display ();
0 commit comments