From: <be...@us...> - 2014-10-08 14:58:25
|
Revision: 12813 http://sourceforge.net/p/xoops/svn/12813 Author: beckmi Date: 2014-10-08 14:58:09 +0000 (Wed, 08 Oct 2014) Log Message: ----------- Merging eForms into xForms 2.0 Alpha 1 Modified Paths: -------------- XoopsModules/xforms/branches/mamba/xforms/admin/about.php XoopsModules/xforms/branches/mamba/xforms/admin/admin_footer.php XoopsModules/xforms/branches/mamba/xforms/admin/admin_header.php XoopsModules/xforms/branches/mamba/xforms/admin/default_elements.php XoopsModules/xforms/branches/mamba/xforms/admin/editelement.php XoopsModules/xforms/branches/mamba/xforms/admin/ele_check.php XoopsModules/xforms/branches/mamba/xforms/admin/ele_html.php XoopsModules/xforms/branches/mamba/xforms/admin/ele_radio.php XoopsModules/xforms/branches/mamba/xforms/admin/ele_select.php XoopsModules/xforms/branches/mamba/xforms/admin/ele_tarea.php XoopsModules/xforms/branches/mamba/xforms/admin/ele_text.php XoopsModules/xforms/branches/mamba/xforms/admin/ele_upload.php XoopsModules/xforms/branches/mamba/xforms/admin/ele_uploadimg.php XoopsModules/xforms/branches/mamba/xforms/admin/ele_yn.php XoopsModules/xforms/branches/mamba/xforms/admin/elements.php XoopsModules/xforms/branches/mamba/xforms/admin/index.php XoopsModules/xforms/branches/mamba/xforms/admin/main.php XoopsModules/xforms/branches/mamba/xforms/admin/menu.php XoopsModules/xforms/branches/mamba/xforms/class/elementrenderer.php XoopsModules/xforms/branches/mamba/xforms/class/elements.php XoopsModules/xforms/branches/mamba/xforms/class/forms.php XoopsModules/xforms/branches/mamba/xforms/class/index.html XoopsModules/xforms/branches/mamba/xforms/class/uploader.php XoopsModules/xforms/branches/mamba/xforms/docs/changelog.txt XoopsModules/xforms/branches/mamba/xforms/docs/credits.txt XoopsModules/xforms/branches/mamba/xforms/docs/install.txt XoopsModules/xforms/branches/mamba/xforms/docs/lang_diff.txt XoopsModules/xforms/branches/mamba/xforms/docs/licence.txt XoopsModules/xforms/branches/mamba/xforms/docs/readme.txt XoopsModules/xforms/branches/mamba/xforms/header.php XoopsModules/xforms/branches/mamba/xforms/include/common.php XoopsModules/xforms/branches/mamba/xforms/include/form_execute.php XoopsModules/xforms/branches/mamba/xforms/include/form_render.php XoopsModules/xforms/branches/mamba/xforms/include/functions.php XoopsModules/xforms/branches/mamba/xforms/include/index.html XoopsModules/xforms/branches/mamba/xforms/index.php XoopsModules/xforms/branches/mamba/xforms/language/english/admin.php XoopsModules/xforms/branches/mamba/xforms/language/english/help/help.html XoopsModules/xforms/branches/mamba/xforms/language/english/index.html XoopsModules/xforms/branches/mamba/xforms/language/english/mail_template/index.html XoopsModules/xforms/branches/mamba/xforms/language/english/mail_template/xforms.tpl XoopsModules/xforms/branches/mamba/xforms/language/english/main.php XoopsModules/xforms/branches/mamba/xforms/language/english/modinfo.php XoopsModules/xforms/branches/mamba/xforms/language/index.html XoopsModules/xforms/branches/mamba/xforms/sql/mysql.sql XoopsModules/xforms/branches/mamba/xforms/templates/index.html XoopsModules/xforms/branches/mamba/xforms/xoops_version.php Added Paths: ----------- XoopsModules/xforms/branches/mamba/xforms/admin/report.php XoopsModules/xforms/branches/mamba/xforms/assets/ XoopsModules/xforms/branches/mamba/xforms/assets/images/ XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/ XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/ XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/1day.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/active.gif XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/content.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/delete.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/edit.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/editcopy.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/expired.gif XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/inactive.gif XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/index.html XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/mail_generic.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/rpthor.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/rpthor0.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/rptsee.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/rptvert.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/rptvert0.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/16/search.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/32/ XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/32/about.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/32/add.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/32/content.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/32/home.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/32/index.html XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/32/insert_table_row.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/32/manage.png XoopsModules/xforms/branches/mamba/xforms/assets/images/icons/index.html XoopsModules/xforms/branches/mamba/xforms/assets/images/index.html XoopsModules/xforms/branches/mamba/xforms/assets/images/xforms.png XoopsModules/xforms/branches/mamba/xforms/assets/index.html XoopsModules/xforms/branches/mamba/xforms/class/constants.php XoopsModules/xforms/branches/mamba/xforms/class/dbupdater.php XoopsModules/xforms/branches/mamba/xforms/class/helper.php XoopsModules/xforms/branches/mamba/xforms/class/session.php XoopsModules/xforms/branches/mamba/xforms/class/userdata.php XoopsModules/xforms/branches/mamba/xforms/class/xforms.php XoopsModules/xforms/branches/mamba/xforms/file.php XoopsModules/xforms/branches/mamba/xforms/include/directorychecker.php XoopsModules/xforms/branches/mamba/xforms/include/filechecker.php XoopsModules/xforms/branches/mamba/xforms/include/module.php XoopsModules/xforms/branches/mamba/xforms/include/oninstall.php XoopsModules/xforms/branches/mamba/xforms/include/onuninstall.php XoopsModules/xforms/branches/mamba/xforms/include/onupdate.php XoopsModules/xforms/branches/mamba/xforms/templates/xforms_error.tpl XoopsModules/xforms/branches/mamba/xforms/templates/xforms_form.tpl XoopsModules/xforms/branches/mamba/xforms/templates/xforms_form_poll.tpl XoopsModules/xforms/branches/mamba/xforms/templates/xforms_index.tpl Removed Paths: ------------- XoopsModules/xforms/branches/mamba/xforms/images/ XoopsModules/xforms/branches/mamba/xforms/templates/xforms_error.html XoopsModules/xforms/branches/mamba/xforms/templates/xforms_form.html XoopsModules/xforms/branches/mamba/xforms/templates/xforms_index.html Modified: XoopsModules/xforms/branches/mamba/xforms/admin/about.php =================================================================== --- XoopsModules/xforms/branches/mamba/xforms/admin/about.php 2014-10-06 19:43:10 UTC (rev 12812) +++ XoopsModules/xforms/branches/mamba/xforms/admin/about.php 2014-10-08 14:58:09 UTC (rev 12813) @@ -1,29 +1,30 @@ <?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ /** * xForms module * - * You may not change or alter any portion of this comment or credits - * of supporting developers from this source code or any supporting source code - * which is considered copyrighted (c) material of the original comment or credit authors. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * -* @copyright The XOOPS Project (http://www.xoops.org) - * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} - * @package xforms - * @since 2.5.0 - * @author Mage, Mamba - * @version $Id $ - **/ + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @package xforms + * @since 1.30 + * @author Xoops Development Team + */ -include_once dirname(__FILE__) . '/admin_header.php'; +include_once __DIR__ . '/admin_header.php'; xoops_cp_header(); $aboutAdmin = new ModuleAdmin(); echo $aboutAdmin->addNavigation('about.php'); -echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false); +echo $aboutAdmin->renderAbout('', true); -include 'admin_footer.php'; \ No newline at end of file +include __DIR__ . '/admin_footer.php'; Modified: XoopsModules/xforms/branches/mamba/xforms/admin/admin_footer.php =================================================================== --- XoopsModules/xforms/branches/mamba/xforms/admin/admin_footer.php 2014-10-06 19:43:10 UTC (rev 12812) +++ XoopsModules/xforms/branches/mamba/xforms/admin/admin_footer.php 2014-10-08 14:58:09 UTC (rev 12813) @@ -1,23 +1,26 @@ <?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ /** * xForms module * - * You may not change or alter any portion of this comment or credits - * of supporting developers from this source code or any supporting source code - * which is considered copyrighted (c) material of the original comment or credit authors. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * @copyright:: The XOOPS Project http://sourceforge.net/projects/xoops/ - * @license:: {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} - * @package:: xDirectory - * @subpackage:: admin - * @since: 2.5.0 - * @author:: XOOPS Development Team - * @version:: $Id $ -**/ + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @package xforms + * @since 1.30 + * @author Xoops Development Team + */ +global $xoopsModule; +$pathIcon32 = '../' . $xoopsModule->getInfo('icons32'); + echo "<div class='adminfooter'>\n" ." <div style='text-align: center;'>\n" ." <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" @@ -25,4 +28,4 @@ ." " . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" ."</div>"; -xoops_cp_footer(); \ No newline at end of file +xoops_cp_footer(); Modified: XoopsModules/xforms/branches/mamba/xforms/admin/admin_header.php =================================================================== --- XoopsModules/xforms/branches/mamba/xforms/admin/admin_header.php 2014-10-06 19:43:10 UTC (rev 12812) +++ XoopsModules/xforms/branches/mamba/xforms/admin/admin_header.php 2014-10-08 14:58:09 UTC (rev 12813) @@ -1,51 +1,48 @@ <?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ /** - * XoopsPartners module + * xForms module * - * You may not change or alter any portion of this comment or credits - * of supporting developers from this source code or any supporting source code - * which is considered copyrighted (c) material of the original comment or credit authors. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * @copyright:: The XOOPS Project http://sourceforge.net/projects/xoops/ - * @license:: {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} - * @package:: XoopsPartners - * @subpackage:: admin - * @since:: 2.5.0 - * @author:: XOOPS Team - * @version:: $Id $ -**/ + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @package xforms + * @since 1.30 + * @author Xoops Development Team + */ +include_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; +include_once XOOPS_ROOT_PATH . '/include/cp_functions.php'; +require_once XOOPS_ROOT_PATH . '/include/cp_header.php'; -$path = dirname(dirname(dirname(dirname(__FILE__)))); -include_once $path . '/mainfile.php'; -include_once $path . '/include/cp_functions.php'; -require_once $path . '/include/cp_header.php'; +include dirname(__DIR__) .'/include/common.php'; +define('XFORMS_ADMIN_URL', XFORMS_URL . '/admin/main.php'); +include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; -include '../include/common.php'; -define('xforms_ADMIN_URL', xforms_URL.'admin/main.php'); -include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; - global $xoopsModule; -$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname'); +$thisModuleDir = XFORMS_DIRNAME; //if functions.php file exist -require_once dirname(dirname(__FILE__)) . '/include/functions.php'; +require_once dirname(__DIR__) . '/include/functions.php'; // Load language files -xoops_loadLanguage('admin', $thisModuleDir); -xoops_loadLanguage('modinfo', $thisModuleDir); -xoops_loadLanguage('main', $thisModuleDir); +xoops_loadLanguage('admin', XFORMS_DIRNAME); +xoops_loadLanguage('modinfo', XFORMS_DIRNAME); +xoops_loadLanguage('main', XFORMS_DIRNAME); -$pathIcon16 = '../'.$xoopsModule->getInfo('icons16'); -$pathIcon32 = '../'.$xoopsModule->getInfo('icons32'); +$pathIcon16 = '../' . $xoopsModule->getInfo('icons16'); +$pathIcon32 = '../' . $xoopsModule->getInfo('icons32'); $pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin'); -if ( file_exists($GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'))){ - include_once $GLOBALS['xoops']->path($pathModuleAdmin.'/moduleadmin.php'); - }else{ - redirect_header("../../../admin.php", 5, _AM_MODULEADMIN_MISSING, false); - } \ No newline at end of file +$mypathIcon16 = XOOPS_URL . '/modules/' . $thisModuleDir . '/assets/images/icons/16'; +//$pathIcon32 = '../'.$xoopsModule->getInfo('icons32'); + +include_once $GLOBALS['xoops']->path($pathModuleAdmin . '/moduleadmin.php'); Modified: XoopsModules/xforms/branches/mamba/xforms/admin/default_elements.php =================================================================== --- XoopsModules/xforms/branches/mamba/xforms/admin/default_elements.php 2014-10-06 19:43:10 UTC (rev 12812) +++ XoopsModules/xforms/branches/mamba/xforms/admin/default_elements.php 2014-10-08 14:58:09 UTC (rev 12813) @@ -1,41 +1,60 @@ <?php -############################################################################### -## See license.txt ## -############################################################################### -if( !defined('xforms_ROOT_PATH') ){ exit(); } +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. -$defaults = array(); -$defaults[0]['caption'] = _AM_ELE_YOUR_NAME; -$defaults[0]['req'] = true; -$defaults[0]['order'] = 1; -$defaults[0]['display'] = 1; -$defaults[0]['type'] = 'text'; -$defaults[0]['value'] = array( - 0 => $xoopsModuleConfig['t_width'], - 1 => $xoopsModuleConfig['t_max'], - 2 => '{UNAME}' - ); + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * xForms module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @package xforms + * @since 1.30 + * @author Xoops Development Team + */ -$defaults[1]['caption'] = _AM_ELE_YOUR_EMAIL; -$defaults[1]['req'] = true; -$defaults[1]['order'] = 2; -$defaults[1]['display'] = 1; -$defaults[1]['type'] = 'text'; -$defaults[1]['value'] = array( - 0 => $xoopsModuleConfig['t_width'], - 1 => $xoopsModuleConfig['t_max'], - 2 => '{EMAIL}' - ); +if (!defined('XFORMS_ROOT_PATH')) { + exit(); +} -$defaults[2]['caption'] = _AM_ELE_YOUR_COMMENTS; -$defaults[2]['req'] = true; -$defaults[2]['order'] = 3; -$defaults[2]['display'] = 1; -$defaults[2]['type'] = 'textarea'; -$defaults[2]['value'] = array( - 0 => '', - 1 => $xoopsModuleConfig['ta_rows'], - 2 => $xoopsModuleConfig['ta_cols'] - ); +$defaults = array(); +$defaults[0]['caption'] = _AM_XFORMS_DEFAULT_ELE_YOURNAME; +$defaults[0]['req'] = true; +$defaults[0]['ele_display_row'] = 1; +$defaults[0]['order'] = 1; +$defaults[0]['display'] = 1; +$defaults[0]['type'] = 'text'; +$defaults[0]['value'] = array( + 0 => $xoopsModuleConfig['t_width'], + 1 => $xoopsModuleConfig['t_max'], + 2 => '{U_uname}' +); -?> \ No newline at end of file +$defaults[1]['caption'] = _AM_XFORMS_DEFAULT_ELE_YOUREMAIL; +$defaults[1]['req'] = true; +$defaults[1]['ele_display_row'] = 1; +$defaults[1]['order'] = 2; +$defaults[1]['display'] = 1; +$defaults[1]['type'] = 'text'; +$defaults[1]['value'] = array( + 0 => $xoopsModuleConfig['t_width'], + 1 => $xoopsModuleConfig['t_max'], + 2 => '{U_email}' +); + +$defaults[2]['caption'] = _AM_XFORMS_DEFAULT_ELE_COMMENTS; +$defaults[2]['req'] = true; +$defaults[2]['ele_display_row'] = 1; +$defaults[2]['order'] = 3; +$defaults[2]['display'] = 1; +$defaults[2]['type'] = 'textarea'; +$defaults[2]['value'] = array( + 0 => '', + 1 => $xoopsModuleConfig['ta_rows'], + 2 => $xoopsModuleConfig['ta_cols'] +); Modified: XoopsModules/xforms/branches/mamba/xforms/admin/editelement.php =================================================================== --- XoopsModules/xforms/branches/mamba/xforms/admin/editelement.php 2014-10-06 19:43:10 UTC (rev 12812) +++ XoopsModules/xforms/branches/mamba/xforms/admin/editelement.php 2014-10-08 14:58:09 UTC (rev 12813) @@ -1,218 +1,283 @@ <?php -############################################################################### -## See license.txt ## -############################################################################### -include("admin_header.php"); +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * xForms module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @package xforms + * @since 1.30 + * @author Xoops Development Team + */ + +include __DIR__ . '/admin_header.php'; $xforms_ele_mgr = xoops_getmodulehandler('elements'); -include_once xforms_ROOT_PATH.'class/elementrenderer.php'; -define('_THIS_PAGE', xforms_URL.'admin/editelement.php'); +include_once XFORMS_ROOT_PATH . '/class/elementrenderer.php'; +define('_THIS_PAGE', XFORMS_URL . '/admin/editelement.php'); $myts = MyTextSanitizer::getInstance(); -if( $xforms_form_mgr->getCount() < 1 ){ - redirect_header(xforms_ADMIN_URL, 0, _AM_GO_CREATE_FORM); +if ($xforms_form_mgr->getCount() < 1) { + redirect_header(XFORMS_ADMIN_URL, 0, _AM_XFORMS_GO_CREATE_FORM); } -if( count($_POST) > 0 ){ - extract($_POST); -}else{ - extract($_GET); +if (count($_POST) > 0) { + extract($_POST); +} else { + extract($_GET); } -$op = isset($_GET['op']) ? trim($_GET['op']) : ''; -$op = isset($_POST['op']) ? trim($_POST['op']) : $op; -$clone = isset($_GET['clone']) ? intval($_GET['clone']) : 0; -$clone = isset($_POST['clone']) ? trim($_POST['clone']) : $clone; -$form_id = isset($_GET['form_id']) ? intval($_GET['form_id']) : 0; +$op = isset($_GET['op']) ? trim($_GET['op']) : ''; +$op = isset($_POST['op']) ? trim($_POST['op']) : $op; +$clone = isset($_GET['clone']) ? intval($_GET['clone'], 10) : 0; +$clone = isset($_POST['clone']) ? trim($_POST['clone']) : $clone; +$form_id = isset($_GET['form_id']) ? intval($_GET['form_id'], 10) : 0; $form_id = isset($_POST['form_id']) ? trim($_POST['form_id']) : $form_id; -if( isset($_POST['submit']) && $_POST['submit'] == _AM_ELE_ADD_OPT_SUBMIT && intval($_POST['addopt']) > 0 ){ - $op = 'edit'; +if (isset($_POST['submit']) && $_POST['submit'] == _AM_XFORMS_ELE_ADD_OPT_SUBMIT && intval($_POST['addopt'], 10) > 0) { + $op = 'edit'; } -switch($op){ - case 'edit': - //adminHtmlHeader(); - xoops_cp_header(); - if( !empty($ele_id) ){ - $element = $xforms_ele_mgr->get($ele_id); - $ele_type = $element->getVar('ele_type'); - $output_title = $clone ? _AM_ELE_CREATE : sprintf(_AM_ELE_EDIT, $element->getVar('ele_caption')); - }else{ - $element = $xforms_ele_mgr->create(); - $output_title = _AM_ELE_CREATE; - } - $output = new XoopsThemeForm($output_title, 'form_ele', _THIS_PAGE); - if( empty($addopt) ){ - $ele_caption = $clone ? sprintf(_AM_COPIED, $element->getVar('ele_caption', 'f')) : $element->getVar('ele_caption', 'f'); - $text_ele_caption = new XoopsFormText(_AM_ELE_CAPTION, 'ele_caption', 50, 255, $ele_caption); - $value = $element->getVar('ele_value', 'f'); - $req = $element->getVar('ele_req'); - $display = $element->getVar('ele_display'); - $order = $element->getVar('ele_order'); - }else{ - $ele_caption = $myts->makeTboxData4PreviewInForm($ele_caption); - $text_ele_caption = new XoopsFormText(_AM_ELE_CAPTION, 'ele_caption', 50, 255, $ele_caption); - $req = isset($_POST['ele_req']) ? 1 : 0; - $display = isset($_POST['ele_display']) ? 1 : 0; - $order = isset($_POST['ele_order']) ? intval($_POST['ele_order']) : 0; - } - $output->addElement($text_ele_caption); +switch ($op) { + case 'edit': + xoops_cp_header(); - $check_ele_req = new XoopsFormCheckBox(_AM_ELE_REQ, 'ele_req', $req); - $check_ele_req->addOption(1, ' '); - $output->addElement($check_ele_req); - - $check_ele_display = new XoopsFormCheckBox(_AM_ELE_DISPLAY, 'ele_display', $display); - $check_ele_display->addOption(1, ' '); - $output->addElement($check_ele_display); - - $text_ele_order = new XoopsFormText(_AM_ELE_ORDER, 'ele_order', 3, 2, $order); - $output->addElement($text_ele_order); - - switch($ele_type){ - case 'text': - default: - include 'ele_text.php'; - break; - case 'textarea': - include 'ele_tarea.php'; - break; - case 'select': - include 'ele_select.php'; - break; + if (!empty($ele_id)) { + $element = $xforms_ele_mgr->get($ele_id); + $ele_type = $element->getVar('ele_type'); + $output_title = $clone ? _AM_XFORMS_ELE_CREATE : sprintf(_AM_XFORMS_ELE_EDIT, $element->getVar('ele_caption')); + } else { + $element = $xforms_ele_mgr->create(); + $output_title = _AM_XFORMS_ELE_CREATE; + } + $output = new XoopsThemeForm($output_title, 'form_ele', _THIS_PAGE); + if (empty($addopt)) { + $ele_caption = $clone ? sprintf(_AM_XFORMS_COPIED, $element->getVar('ele_caption', 'e')) : $element->getVar('ele_caption', 'e'); + $text_ele_caption = new XoopsFormDhtmlTextArea(_AM_XFORMS_ELE_CAPTION, 'ele_caption', $myts->htmlspecialchars($myts->stripSlashesGPC($ele_caption)), 5, 90); + $text_ele_caption->skipPreview = true; + $value = $element->getVar('ele_value', 'f'); + $req = $element->getVar('ele_req'); + $display_row = $element->getVar('ele_display_row'); + $display = $element->getVar('ele_display'); + $order = $element->getVar('ele_order'); + } else { + $text_ele_caption = new XoopsFormDhtmlTextArea(_AM_XFORMS_ELE_CAPTION, 'ele_caption', $myts->htmlspecialchars($myts->stripSlashesGPC($ele_caption)), 5, 90); + $text_ele_caption->skipPreview = true; + $req = isset($_POST['ele_req']) ? 1 : 0; + $display_row = isset($_POST['ele_display_row']) ? 2 : 1; + $display = isset($_POST['ele_display']) ? 1 : 0; + $order = isset($_POST['ele_order']) ? intval($_POST['ele_order'], 10) : 0; + } + + if ($ele_type != 'html') { + $output->addElement($text_ele_caption); + + $check_ele_req = new XoopsFormCheckBox(_AM_XFORMS_ELE_REQ, 'ele_req', $req); + $check_ele_req->addOption(1, ' '); + $output->addElement($check_ele_req); + + $check_ele_display_row = new XoopsFormCheckBox(_AM_XFORMS_ELE_DISPLAY_ROW, 'ele_display_row', $display_row); + $check_ele_display_row->setDescription(_AM_XFORMS_ELE_DISPLAY_ROW_DESC); + $check_ele_display_row->addOption(2, ' '); + $output->addElement($check_ele_display_row); + } + + $check_ele_display = new XoopsFormCheckBox(_AM_XFORMS_ELE_DISPLAY, 'ele_display', $display); + $check_ele_display->addOption(1, ' '); + $output->addElement($check_ele_display); + + $text_ele_order = new XoopsFormText(_AM_XFORMS_ELE_ORDER, 'ele_order', 3, 2, $order); + $output->addElement($text_ele_order); + + $elementName = ""; + switch ($ele_type) { + case 'text': + default: + $elementName = _AM_XFORMS_ELE_TEXT; + include 'ele_text.php'; + break; + + case 'textarea': + $elementName = _AM_XFORMS_ELE_TAREA; + include 'ele_tarea.php'; + break; + + case 'select': + $elementName = _AM_XFORMS_ELE_SELECT; + include 'ele_select.php'; + break; case 'select2': + $elementName = _AM_XFORMS_ELE_COUNTRY; include 'ele_select_ctry.php'; break; case 'date': + $elementName = _AM_XFORMS_ELE_DATE; include 'ele_date.php'; break; - case 'checkbox': - include 'ele_check.php'; - break; - case 'radio': - include 'ele_radio.php'; - break; - case 'yn': - include 'ele_yn.php'; - break; - case 'html': - $check_ele_req->setExtra('disabled="disabled"'); - include 'ele_html.php'; - break; - case 'uploadimg': - include 'ele_uploadimg.php'; - break; - case 'upload': - include 'ele_upload.php'; - break; - } + case 'checkbox': + $elementName = _AM_XFORMS_ELE_CHECK; + include 'ele_check.php'; + break; - $hidden_op = new XoopsFormHidden('op', 'save'); - $hidden_type = new XoopsFormHidden('ele_type', $ele_type); - $output->addElement($hidden_op); - $output->addElement($hidden_type); - - if( $clone == true || empty($form_id) ){ - $select_apply_form = new XoopsFormSelect(_AM_ELE_APPLY_TO_FORM, 'form_id', $form_id); - $forms = $xforms_form_mgr->getObjects(null, 'form_id, form_title'); - foreach( $forms as $f ){ - $select_apply_form->addOption($f->getVar('form_id'), $f->getVar('form_title')); - } - $output->addElement($select_apply_form); - $hidden_clone = new XoopsFormHidden('clone', 1); - $output->addElement($hidden_clone); - }else{ - $hidden_form_id = new XoopsFormHidden('form_id', $form_id); - $output->addElement($hidden_form_id); - } - - if( !empty($ele_id) && !$clone ){ - $hidden_id = new XoopsFormHidden('ele_id', $ele_id); - $output->addElement($hidden_id); - } - $submit = new XoopsFormButton('', 'submit', _AM_SAVE, 'submit'); - $cancel = new XoopsFormButton('', 'cancel', _CANCEL, 'button'); - $cancel->setExtra('onclick="javascript:history.go(-1);"'); - $tray = new XoopsFormElementTray(''); - $tray->addElement($submit); - $tray->addElement($cancel); - $output->addElement($tray); - $output->display(); - break; - case 'delete': - if( empty($ele_id) ){ - redirect_header(xforms_ADMIN_URL, 0, _AM_NOTHING_SELECTED); - } - if( empty($_POST['ok']) ){ - //adminHtmlHeader(); - xoops_cp_header(); - xoops_confirm(array('op' => 'delete', 'ele_id' => $ele_id, 'form_id' => $form_id, 'ok' => 1), _THIS_PAGE, _AM_ELE_CONFIRM_DELETE); - }else{ - $element = $xforms_ele_mgr->get($ele_id); - $xforms_ele_mgr->delete($element); - redirect_header(xforms_URL.'admin/elements.php?form_id='.$form_id, 0, _AM_DBUPDATED); - } - break; - case 'save': - if( !empty($ele_id) ){ - $element = $xforms_ele_mgr->get($ele_id); - }else{ - $element = $xforms_ele_mgr->create(); - } - $element->setVar('form_id', $form_id); - $element->setVar('ele_caption', $ele_caption); - $req = !empty($ele_req) ? 1 : 0; - $element->setVar('ele_req', $req); - $order = empty($ele_order) ? 0 : intval($ele_order); - $element->setVar('ele_order', $order); - $display = !empty($ele_display) ? 1 : 0; - $element->setVar('ele_display', $display); - $element->setVar('ele_type', $ele_type); - $value = array(); - switch($ele_type){ - case 'text': - $value[] = !empty($ele_value[0]) ? intval($ele_value[0]) : $xoopsModuleConfig['t_width']; - $value[] = !empty($ele_value[1]) ? intval($ele_value[1]) : $xoopsModuleConfig['t_max']; - $value[] = $ele_value[2]; - break; - case 'textarea': - case 'html': - $value[] = $ele_value[0]; - if( intval($ele_value[1]) != 0 ){ - $value[] = intval($ele_value[1]); - }else{ - $value[] = $xoopsModuleConfig['ta_rows']; - } - if( intval($ele_value[2]) != 0 ){ - $value[] = intval($ele_value[2]); - }else{ - $value[] = $xoopsModuleConfig['ta_cols']; - } - break; - case 'select': + case 'radio': + $elementName = _AM_XFORMS_ELE_RADIO; + include 'ele_radio.php'; + break; + + case 'yn': + $elementName = _AM_XFORMS_ELE_YN; + include 'ele_yn.php'; + break; + + case 'html': + $elementName = _AM_XFORMS_ELE_HTML; + include 'ele_html.php'; + break; + + case 'uploadimg': + $elementName = _AM_XFORMS_ELE_UPLOADIMG; + include 'ele_uploadimg.php'; + break; + + case 'upload': + $elementName = _AM_XFORMS_ELE_UPLOADFILE; + include 'ele_upload.php'; + break; + } + + $hidden_op = new XoopsFormHidden('op', 'save'); + $hidden_type = new XoopsFormHidden('ele_type', $ele_type); + $output->addElement($hidden_op); + $output->addElement($hidden_type); + + if ($clone == true || empty($form_id)) { + $select_apply_form = new XoopsFormSelect(_AM_XFORMS_ELE_APPLY_TO_FORM, 'form_id', $form_id); + $forms = $xforms_form_mgr->getObjects(null, 'form_id, form_title'); + foreach ($forms as $f) { + $select_apply_form->addOption($f->getVar('form_id'), $f->getVar('form_title')); + } + $output->addElement($select_apply_form); + $hidden_clone = new XoopsFormHidden('clone', 1); + $output->addElement($hidden_clone); + } else { + $hidden_form_id = new XoopsFormHidden('form_id', $form_id); + $output->addElement($hidden_form_id); + } + + if (!empty($ele_id) && !$clone) { + $hidden_id = new XoopsFormHidden('ele_id', $ele_id); + $output->addElement($hidden_id); + } + $submit = new XoopsFormButton('', 'submit', _AM_XFORMS_SAVE, 'submit'); + $cancel = new XoopsFormButton('', 'cancel', _CANCEL, 'button'); + $cancel->setExtra('onclick="javascript:history.go(-1);"'); + $tray = new XoopsFormElementTray(''); + $tray->addElement($submit); + $tray->addElement($cancel); + $output->addElement($tray); + echo '<h4 style="text-align: center;">' . $elementName . '</h4>'; + $output->display(); + break; + + case 'delete': + if (empty($ele_id)) { + redirect_header(XFORMS_ADMIN_URL, 0, _AM_XFORMS_NOTHING_SELECTED); + } + if (empty($_POST['ok'])) { + xoops_cp_header(); + xoops_confirm(array('op' => 'delete', 'ele_id' => $ele_id, 'form_id' => $form_id, 'ok' => 1), _THIS_PAGE, _AM_XFORMS_ELE_CONFIRM_DELETE); + } else { + $element = $xforms_ele_mgr->get($ele_id); + $xforms_ele_mgr->delete($element); + redirect_header(XFORMS_URL . '/admin/elements.php?form_id=' . $form_id, 0, _AM_XFORMS_DBUPDATED); + } + break; + + case 'save': + if (!empty($ele_id)) { + $element = $xforms_ele_mgr->get($ele_id); + } else { + $element = $xforms_ele_mgr->create(); + } + $element->setVar('form_id', $form_id); + $element->setVar('ele_caption', $ele_caption); + $req = (isset($ele_req)) ? 1 : 0; + $element->setVar('ele_req', $req); + if ($ele_type != 'html') { + $display_row = (isset($ele_display_row)) ? 2 : 1; + $element->setVar('ele_display_row', $display_row); + } else { + $element->setVar('ele_display_row', 0); + } + $order = empty($ele_order) ? 0 : intval($ele_order, 10); + $element->setVar('ele_order', $order); + $display = (isset($ele_display)) ? 1 : 0; + $element->setVar('ele_display', $display); + $element->setVar('ele_type', $ele_type); + $value = array(); + + $magicQuotes = false; // Flag to fix problem with slashes + if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()) { + $magicQuotes = true; + } + switch ($ele_type) { + case 'text': + $value[] = !empty($ele_value[0]) ? intval($ele_value[0], 10) : $xoopsModuleConfig['t_width']; + $value[] = !empty($ele_value[1]) ? intval($ele_value[1], 10) : $xoopsModuleConfig['t_max']; + $value[] = ($magicQuotes) ? stripslashes($ele_value[2]) : $ele_value[2]; + $value[] = $ele_value[3]; + + break; + + case 'textarea': + $value[] = ($magicQuotes) ? stripslashes($ele_value[0]) : $ele_value[0]; + if (intval($ele_value[1], 10) != 0) { + $value[] = intval($ele_value[1], 10); + } else { + $value[] = $xoopsModuleConfig['ta_rows']; + } + if (intval($ele_value[2], 10) != 0) { + $value[] = intval($ele_value[2], 10); + } else { + $value[] = $xoopsModuleConfig['ta_cols']; + } + break; + + case 'html': + $value[] = ($magicQuotes) ? stripslashes($ele_value[0]) : $ele_value[0]; + break; + + case 'select': + $value[0] = $ele_value[0] > 1 ? intval($ele_value[0], 10) : 1; + $value[1] = !empty($ele_value[1]) ? 1 : 0; + $v2 = array(); + $multi_flag = 1; + while ($v = each($ele_value[2])) { + if (!empty($v['value'])) { + if ($value[1] == 1 || $multi_flag) { + if ($checked[$v['key']] == 1) { + $check = 1; + $multi_flag = 0; + } else { + $check = 0; + } + } else { + $check = 0; + } + $v2[$v['value']] = $check; + } + } + $value[2] = $v2; + break; + case 'select2': $value[0] = $ele_value[0]>1 ? intval($ele_value[0]) : 1; $value[1] = !empty($ele_value[1]) ? 1 : 0; - $v2 = array(); - $multi_flag = 1; - while( $v = each($ele_value[2]) ){ - if( !empty($v['value']) ){ - if( $value[1] == 1 || $multi_flag ){ - if( $checked[$v['key']] == 1 ){ - $check = 1; - $multi_flag = 0; - }else{ - $check = 0; - } - }else{ - $check = 0; - } - $v2[$v['value']] = $check; - } - } - $value[2] = $v2; - break; - case 'select2': - $value[0] = $ele_value[0]>1 ? intval($ele_value[0]) : 1; - $value[1] = !empty($ele_value[1]) ? 1 : 0; $value[2] = !empty($ele_value[2]) ? $ele_value[2] : 'LB'; /* $v2 = array(); @@ -235,112 +300,151 @@ $value[2] = $v2; */ break; - case 'date': - $value = array(); - $value[] = $ele_value; - + case 'date': + $value = array(); + $value[] = $ele_value; break; - case 'checkbox': - while( $v = each($ele_value) ){ - if( !empty($v['value']) ){ - if( $checked[$v['key']] == 1 ){ - $check = 1; - }else{ - $check = 0; - } - $value[$v['value']] = $check; - } - } - break; - case 'radio': - while( $v = each($ele_value) ){ - if( !empty($v['value']) ){ - if( $checked == $v['key'] ){ - $value[$v['value']] = 1; - }else{ - $value[$v['value']] = 0; - } - } - } - break; - case 'yn': - if( $ele_value == '_NO' ){ - $value = array('_YES'=>0,'_NO'=>1); - }else{ - $value = array('_YES'=>1,'_NO'=>0); - } - break; - case 'uploadimg': - $value[] = intval($ele_value[0]); - $value[] = trim($ele_value[1]); - $value[] = trim($ele_value[2]); - $value[] = $ele_value[3] != 1 ? 0 : 1; - $value[] = intval($ele_value[4]); - $value[] = intval($ele_value[5]); - break; - case 'upload': - $value[] = intval($ele_value[0]); - $value[] = trim($ele_value[1]); - $value[] = trim($ele_value[2]); - $value[] = $ele_value[3] != 1 ? 0 : 1; - break; - } - $element->setVar('ele_value', $value); - if( !$xforms_ele_mgr->insert($element) ){ - //adminHtmlHeader(); - xoops_cp_header(); - echo $element->getHtmlErrors(); - }else{ - redirect_header(xforms_URL.'admin/elements.php?form_id='.$form_id, 0, _AM_DBUPDATED); - } - break; - default: - xoops_cp_header(); - $indexAdmin = new ModuleAdmin(); - echo $indexAdmin->addNavigation('editelement.php') ; - echo "<h4>"._AM_ELE_CREATE."</h4> - <ul> - <li><a href='"._THIS_PAGE."?op=edit&ele_type=text'>"._AM_ELE_TEXT."</a></li> - <li><a href='"._THIS_PAGE."?op=edit&ele_type=textarea'>"._AM_ELE_TAREA."</a></li> - <li><a href='"._THIS_PAGE."?op=edit&ele_type=select'>"._AM_ELE_SELECT."</a></li> - <li><a href='"._THIS_PAGE."?op=edit&ele_type=select2'>"._AM_ELE_SELECT_CTRY."</a></li> - <li><a href='"._THIS_PAGE."?op=edit&ele_type=date'>"._AM_ELE_DATE."</a></li> - <li><a href='"._THIS_PAGE."?op=edit&ele_type=checkbox'>"._AM_ELE_CHECK."</a></li> - <li><a href='"._THIS_PAGE."?op=edit&ele_type=radio'>"._AM_ELE_RADIO."</a></li> - <li><a href='"._THIS_PAGE."?op=edit&ele_type=yn'>"._AM_ELE_YN."</a></li> - <li><a href='"._THIS_PAGE."?op=edit&ele_type=html'>"._AM_ELE_HTML."</a></li> - <li><a href='"._THIS_PAGE."?op=edit&ele_type=uploadimg'>"._AM_ELE_UPLOADIMG."</a></li> - <li><a href='"._THIS_PAGE."?op=edit&ele_type=upload'>"._AM_ELE_UPLOADFILE."</a></li> - </ul>" - ; - break; + + case 'checkbox': + while ($v = each($ele_value)) { + if (!empty($v['value'])) { + if ($checked[$v['key']] == 1) { + $check = 1; + } else { + $check = 0; + } + $value[$v['value']] = $check; + } + } + break; + + case 'radio': + while ($v = each($ele_value)) { + if (!empty($v['value'])) { + if ($checked == $v['key']) { + $value[$v['value']] = 1; + } else { + $value[$v['value']] = 0; + } + } + } + break; + + case 'yn': + if ($ele_value == '_NO') { + $value = array('_YES' => 0, '_NO' => 1); + } else { + $value = array('_YES' => 1, '_NO' => 0); + } + break; + + case 'uploadimg': + $value[] = intval($ele_value[0], 10); + $value[] = trim($ele_value[1]); + $value[] = trim($ele_value[2]); + $value[] = $ele_value[3] != 1 ? 0 : 1; + $value[] = intval($ele_value[4], 10); + $value[] = intval($ele_value[5], 10); + break; + + case 'upload': + $value[] = intval($ele_value[0], 10); + $value[] = trim($ele_value[1]); + $value[] = trim($ele_value[2]); + $value[] = $ele_value[3] != 1 ? 0 : 1; + break; + } + $element->setVar('ele_value', $value); + if (!$xforms_ele_mgr->insert($element)) { + xoops_cp_header(); + echo $element->getHtmlErrors(); + } else { + redirect_header(XFORMS_URL . '/admin/elements.php?form_id=' . $form_id, 0, _AM_XFORMS_DBUPDATED); + } + break; + + default: + xoops_cp_header(); + $indexAdmin = new ModuleAdmin(); + echo $indexAdmin->addNavigation('editelement.php'); + echo '<table class="outer" cellspacing="1" width="100%"> + <tr><th>' . _AM_XFORMS_ELE_CREATE . '</th></tr> + <tr> + <td class="odd" align="center"><a href="' . _THIS_PAGE . '?op=edit&ele_type=text">' . _AM_XFORMS_ELE_TEXT . '</a></td> + </tr> + <tr> + <td class="even" align="center"><a href="' . _THIS_PAGE . '?op=edit&ele_type=textarea">' . _AM_XFORMS_ELE_TAREA . '</a></td> + </tr> + <tr> + <td class="odd" align="center"><a href="' . _THIS_PAGE . '?op=edit&ele_type=select">' . _AM_XFORMS_ELE_SELECT . '</a></td> + </tr> + <tr> + <td class="even" align="center"><a href="'._THIS_PAGE.'?op=edit&ele_type=select2">'. _AM_XFORMS_ELE_SELECT_CTRY .'</a></td> + </tr> + <tr> + <td class="odd" align="center"><a href="'._THIS_PAGE.'?op=edit&ele_type=date">'._AM_XFORMS_ELE_DATE.'</a></td> + </tr> + <tr> + <td class="even" align="center"><a href="' . _THIS_PAGE . '?op=edit&ele_type=checkbox">' . _AM_XFORMS_ELE_CHECK . '</a></td> + </tr> + <tr> + <td class="odd" align="center"><a href="' . _THIS_PAGE . '?op=edit&ele_type=radio">' . _AM_XFORMS_ELE_RADIO . '</a></td> + </tr> + <tr> + <td class="even" align="center"><a href="' . _THIS_PAGE . '?op=edit&ele_type=yn">' . _AM_XFORMS_ELE_YN . '</a></td> + </tr> + <tr> + <td class="odd" align="center"><a href="' . _THIS_PAGE . '?op=edit&ele_type=html">' . _AM_XFORMS_ELE_HTML . '</a></td> + </tr> + <tr> + <td class="even" align="center"><a href="' . _THIS_PAGE . '?op=edit&ele_type=uploadimg">' . _AM_XFORMS_ELE_UPLOADIMG . '</a></td> + </tr> + <tr> + <td class="odd" align="center"><a href="' . _THIS_PAGE . '?op=edit&ele_type=upload">' . _AM_XFORMS_ELE_UPLOADFILE . '</a></td> + </tr> + </table>'; + break; } -include 'admin_footer.php'; +include __DIR__ . '/admin_footer.php'; xoops_cp_footer(); +/** + * @param $id1 + * @param $id2 + * @param string $text + * @param string $type + * @param null $checked + * + * @return XoopsFormElementTray + */ +function addOption($id1, $id2, $text = '', $type = 'check', $checked = null) +{ + $d = new XoopsFormText('', $id1, 40, 255, $text); + if ($type == 'check') { + $c = new XoopsFormCheckBox('', $id2, $checked); + $c->addOption(1, ' '); + } else { + $c = new XoopsFormRadio('', 'checked', $checked); + $c->addOption($id2, ' '); + } + $t = new XoopsFormElementTray(''); + $t->addElement($c); + $t->addElement($d); -function addOption($id1, $id2, $text='', $type='check', $checked=null){ - $d = new XoopsFormText('', $id1, 40, 255, $text); - if( $type == 'check' ){ - $c = new XoopsFormCheckBox('', $id2, $checked); - $c->addOption(1, ' '); - }else{ - $c = new XoopsFormRadio('', 'checked', $checked); - $c->addOption($id2, ' '); - } - $t = new XoopsFormElementTray(''); - $t->addElement($c); - $t->addElement($d); - return $t; + return $t; } -function addOptionsTray(){ - $t = new XoopsFormText('', 'addopt', 3, 2); - $l = new XoopsFormLabel('', sprintf(_AM_ELE_ADD_OPT, $t->render())); - $b = new XoopsFormButton('', 'submit', _AM_ELE_ADD_OPT_SUBMIT, 'submit'); - $r = new XoopsFormElementTray(''); - $r->addElement($l); - $r->addElement($b); - return $r; +/** + * @return XoopsFormElementTray + */ +function addOptionsTray() +{ + $t = new XoopsFormText('', 'addopt', 3, 2); + $l = new XoopsFormLabel('', sprintf(_AM_XFORMS_ELE_ADD_OPT, $t->render())); + $b = new XoopsFormButton('', 'submit', _AM_XFORMS_ELE_ADD_OPT_SUBMIT, 'submit'); + $r = new XoopsFormElementTray(''); + $r->addElement($l); + $r->addElement($b); + + return $r; } -?> \ No newline at end of file Modified: XoopsModules/xforms/branches/mamba/xforms/admin/ele_check.php =================================================================== --- XoopsModules/xforms/branches/mamba/xforms/admin/ele_check.php 2014-10-06 19:43:10 UTC (rev 12812) +++ XoopsModules/xforms/branches/mamba/xforms/admin/ele_check.php 2014-10-08 14:58:09 UTC (rev 12813) @@ -1,40 +1,57 @@ <?php -############################################################################### -## See license.txt ## -############################################################################### -if( !defined('xforms_ROOT_PATH') ){ exit(); } +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. -$options = array(); + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * xForms module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @package xforms + * @since 1.30 + * @author Xoops Development Team + */ + +if (!defined('XFORMS_ROOT_PATH')) { + exit(); +} + +$options = array(); $opt_count = 0; -if( empty($addopt) && !empty($ele_id) ){ - $keys = array_keys($value); - for( $i=0; $i<count($keys); $i++ ){ - $v = $myts->makeTboxData4PreviewInForm($keys[$i]); - $options[] = addOption('ele_value['.$opt_count.']', 'checked['.$opt_count.']', $v, 'check', $value[$keys[$i]]); - $opt_count++; - } -}else{ - if( isset($ele_value) && count($ele_value) > 0 ){ - while( $v = each($ele_value) ){ - $v['value'] = $myts->makeTboxData4PreviewInForm($v['value']); - if( !empty($v['value']) ){ - $options[] = addOption('ele_value['.$opt_count.']', 'checked['.$opt_count.']', $v['value'], 'check', $checked[$v['key']]); - $opt_count++; - } - } - } - $addopt = empty($addopt) ? 2 : $addopt; - for( $i=0; $i<$addopt; $i++ ){ - $options[] = addOption('ele_value['.$opt_count.']', 'checked['.$opt_count.']'); - $opt_count++; - } +if (empty($addopt) && !empty($ele_id)) { + $keys = array_keys($value); + for ($i = 0; $i < count($keys); ++$i) { + $v = $myts->makeTboxData4PreviewInForm($keys[$i]); + $options[] = addOption('ele_value[' . $opt_count . ']', 'checked[' . $opt_count . ']', $v, 'check', $value[$keys[$i]]); + ++$opt_count; + } +} else { + if (isset($ele_value) && count($ele_value) > 0) { + while ($v = each($ele_value)) { + $v['value'] = $myts->makeTboxData4PreviewInForm($v['value']); + if (!empty($v['value'])) { + $options[] = addOption('ele_value[' . $opt_count . ']', 'checked[' . $opt_count . ']', $v['value'], 'check', $checked[$v['key']]); + ++$opt_count; + } + } + } + $addopt = empty($addopt) ? 2 : $addopt; + for ($i = 0; $i < $addopt; ++$i) { + $options[] = addOption('ele_value[' . $opt_count . ']', 'checked[' . $opt_count . ']'); + ++$opt_count; + } } -$add_opt = addOptionsTray(); +$add_opt = addOptionsTray(); $options[] = $add_opt; -$opt_tray = new XoopsFormElementTray(_AM_ELE_OPT, '<br />'); -$opt_tray->setDescription(_AM_ELE_OPT_DESC.'<br /><br />'._AM_ELE_OTHER); -for( $i=0; $i<count($options); $i++ ){ - $opt_tray->addElement($options[$i]); +$opt_tray = new XoopsFormElementTray(_AM_XFORMS_ELE_OPT, '<br />'); +$opt_tray->setDescription(_AM_XFORMS_ELE_OPT_DESC . '<br /><br />' . _AM_XFORMS_ELE_OTHER); +for ($i = 0; $i < count($options); ++$i) { + $opt_tray->addElement($options[$i]); } $output->addElement($opt_tray); -?> \ No newline at end of file Modified: XoopsModules/xforms/branches/mamba/xforms/admin/ele_html.php =================================================================== --- XoopsModules/xforms/branches/mamba/xforms/admin/ele_html.php 2014-10-06 19:43:10 UTC (rev 12812) +++ XoopsModules/xforms/branches/mamba/xforms/admin/ele_html.php 2014-10-08 14:58:09 UTC (rev 12813) @@ -1,15 +1,27 @@ <?php -############################################################################### -## See license.txt ## -############################################################################### -if( !defined('xforms_ROOT_PATH') ){ exit(); } +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. -$rows = !empty($value[1]) ? $value[1] : $xoopsModuleConfig['ta_rows']; -$cols = !empty($value[2]) ? $value[2] : $xoopsModuleConfig['ta_cols']; -$rows = new XoopsFormText(_AM_ELE_ROWS, 'ele_value[1]', 3, 3, $rows); -$cols = new XoopsFormText(_AM_ELE_COLS, 'ele_value[2]', 3, 3, $cols); -$default = new XoopsFormDhtmlTextArea(_AM_ELE_DEFAULT, 'ele_value[0]', isset($value[0]) ? $myts->htmlspecialchars($myts->stripSlashesGPC($value[0])) : '', 10, 50); -$output->addElement($rows, 1); -$output->addElement($cols, 1); + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * xForms module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @package xforms + * @since 1.30 + * @author Xoops Development Team + */ + +if (!defined('XFORMS_ROOT_PATH')) { + exit(); +} + +$default = new XoopsFormDhtmlTextArea(_AM_XFORMS_ELE_DEFAULT, 'ele_value[0]', isset($value[0]) ? $myts->htmlspecialchars($myts->stripSlashesGPC($value[0])) : '', 10, 90); +$default->skipPreview = true; $output->addElement($default); -?> \ No newline at end of file Modified: XoopsModules/xforms/branches/mamba/xforms/admin/ele_radio.php =================================================================== --- XoopsModules/xforms/branches/mamba/xforms/admin/ele_radio.php 2014-10-06 19:43:10 UTC (rev 12812) +++ XoopsModules/xforms/branches/mamba/xforms/admin/ele_radio.php 2014-10-08 14:58:09 UTC (rev 12813) @@ -1,41 +1,57 @@ <?php -############################################################################### -## See license.txt ## -############################################################################### -if( !defined('xforms_ROOT_PATH') ){ exit(); } +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. -$options = array(); + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * xForms module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @package xforms + * @since 1.30 + * @author Xoops Development Team + */ +if (!defined('XFORMS_ROOT_PATH')) { + exit(); +} + +$options = array(); $opt_count = 0; -if( empty($addopt) && !empty($ele_id) ){ - $keys = array_keys($value); - for( $i=0; $i<count($keys); $i++ ){ - $r = $value[$keys[$i]] ? $opt_count : null; - $v = $myts->makeTboxData4PreviewInForm($keys[$i]); - $options[] = addOption('ele_value['.$opt_count.']', $opt_count, $v, 'radio', $r); - $opt_count++; - } -}else{ - if( isset($ele_value) && count($ele_value) > 0 ){ - while( $v = each($ele_value) ){ - $v['value'] = $myts->makeTboxData4PreviewInForm($v['value']); - if( !empty($v['value']) ){ - $r = ($checked == $opt_count) ? $opt_count : null; - $options[] = addOption('ele_value['.$opt_count.']', $opt_count, $v['value'], 'radio', $r); - $opt_count++; - } - } - } - $addopt = empty($addopt) ? 2 : $addopt; - for( $i=0; $i<$addopt; $i++ ){ - $options[] = addOption('ele_value['.$opt_count.']', $opt_count, '', 'radio'); - $opt_count++; - } +if (empty($addopt) && !empty($ele_id)) { + $keys = array_keys($value); + for ($i = 0; $i < count($keys); ++$i) { + $r = $value[$keys[$i]] ? $opt_count : null; + $v = $myts->makeTboxData4PreviewInForm($keys[$i]); + $options[] = addOption('ele_value[' . $opt_count . ']', $opt_count, $v, 'radio', $r); + ++$opt_count; + } +} else { + if (isset($ele_value) && count($ele_value) > 0) { + while ($v = each($ele_value)) { + $v['value'] = $myts->makeTboxData4PreviewInForm($v['value']); + if (!empty($v['value'])) { + $r = ($checked == $opt_count) ? $opt_count : null; + $options[] = addOption('ele_value[' . $opt_count . ']', $opt_count, $v['value'], 'radio', $r); + ++$opt_count; + } + } + } + $addopt = empty($addopt) ? 2 : $addopt; + for ($i = 0; $i < $addopt; ++$i) { + $options[] = addOption('ele_value[' . $opt_count . ']', $opt_count, '', 'radio'); + ++$opt_count; + } } $options[] = addOptionsTray(); -$opt_tray = new XoopsFormElementTray(_AM_ELE_OPT, '<br />'); -$opt_tray->setDescription(_AM_ELE_OPT_DESC2.'<br /><br />'._AM_ELE_OTHER); -for( $i=0; $i<count($options); $i++ ){ - $opt_tray->addElement($options[$i]); +$opt_tray = new XoopsFormElementTray(_AM_XFORMS_ELE_OPT, '<br />'); +$opt_tray->setDescription(_AM_XFORMS_ELE_OPT_DESC2 . '<br /><br />' . _AM_XFORMS_ELE_OTHER); +for ($i = 0; $i < count($options); ++$i) { + $opt_tray->addElement($options[$i]); } $output->addElement($opt_tray); -?> \ No newline at end of file Modified: XoopsModules/xforms/branches/mamba/xforms/admin/ele_select.php =================================================================== --- XoopsModules/xforms/branches/mamba/xforms/admin/ele_select.php 2014-10-06 19:43:10 UTC (rev 12812) +++ XoopsModules/xforms/branches/mamba/xforms/admin/ele_select.php 2014-10-08 14:58:09 UTC (rev 12813) @@ -1,52 +1,69 @@ <?php -############################################################################### -## See license.txt ## -############################################################################### -if( !defined('xforms_ROOT_PATH') ){ exit(); } +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. -if( empty($addopt) && !empty($ele_id) ){ - $ele_value = $element->getVar('ele_value'); + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ +/** + * xForms module + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @package xforms + * @since 1.30 + * @author Xoops Development Team + */ + +if (!defined('XFORMS_ROOT_PATH')) { + exit(); } -$ele_size = !empty($ele_value[0]) ? $ele_value[0] : 1; -$size = new XoopsFormText(_AM_ELE_SIZE, 'ele_value[0]', 3, 2, $ele_size); + +if (empty($addopt) && !empty($ele_id)) { + $ele_value = $element->getVar('ele_value'); +} +$ele_size = !empty($ele_value[0]) ? $ele_value[0] : 1; +$size = new XoopsFormText(_AM_XFORMS_ELE_SIZE, 'ele_value[0]', 3, 2, $ele_size); $allow_multi = empty($ele_value[1]) ? 0 : 1; -$multiple = new XoopsFormRadioYN(_AM_ELE_MULTIPLE, 'ele_value[1]', $allow_multi); +$multiple = new XoopsFormRadioYN(_AM_XFORMS_ELE_MULTIPLE, 'ele_value[1]', $allow_multi); -$options = array(); +$options = array(); $opt_count = 0; -if( empty($addopt) && !empty($ele_id) ){ - $keys = array_keys($ele_value[2]); - for( $i=0; $i<count(... [truncated message content] |