From: <tr...@us...> - 2012-12-16 19:09:41
|
Revision: 10413 http://sourceforge.net/p/xoops/svn/10413 Author: trabis Date: 2012-12-16 19:09:38 +0000 (Sun, 16 Dec 2012) Log Message: ----------- Updating preferences Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/preferences/main.php Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/class/form/preferences.php Removed Paths: ------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/class/form/modulepreference.php Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/preferences/main.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/preferences/main.php 2012-12-16 19:06:26 UTC (rev 10412) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/admin/preferences/main.php 2012-12-16 19:09:38 UTC (rev 10413) @@ -58,26 +58,6 @@ switch ($op) { case 'show': - if (empty($confcat_id)) { - $confcat_id = 1; - } - $confcat_handler = $xoops->getHandlerConfigcategory(); - $confcat = $confcat_handler->get($confcat_id); - if (!is_object($confcat)) { - $xoops->redirect('admin.php?fct=preferences', 1); - } - // Define Breadcrumb and tips - $admin_page = new XoopsModuleAdmin(); - $admin_page->addBreadcrumbLink(_AM_SYSTEM_CPANEL, XOOPS_URL . '/admin.php', true); - $admin_page->addBreadcrumbLink(_AM_SYSTEM_PREFERENCES_NAV_MAIN, $system->adminVersion('preferences', 'adminpath')); - $admin_page->addBreadcrumbLink(constant($confcat->getVar('confcat_name'))); - $admin_page->renderBreadcrumb(); - /* @var $form SystemPreferenceForm */ - $form = $xoops->getModuleForm(null, 'preference'); - $form->getForm($confcat); - $xoops->tpl()->assign('form', $form->render()); - break; - case 'showmod': $mod = $system->cleanVars($_GET, 'mod', 1, 'int'); if (!$mod) { @@ -102,8 +82,8 @@ $admin_page->addBreadcrumbLink($module->getVar('name')); $admin_page->renderBreadcrumb(); - /* @var $form SystemModulepreferenceForm */ - $form = $xoops->getModuleForm(null, 'modulepreference'); + /* @var $form SystemPreferencesForm */ + $form = $xoops->getModuleForm(null, 'preferences'); $form->getForm($config, $module); $xoops->tpl()->assign('form', $form->render()); break; Deleted: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/class/form/modulepreference.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/class/form/modulepreference.php 2012-12-16 19:06:26 UTC (rev 10412) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/class/form/modulepreference.php 2012-12-16 19:09:38 UTC (rev 10413) @@ -1,286 +0,0 @@ -<?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. -*/ - -/** - * Preference Form Class - * - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) - * @author Andricq Nicolas (AKA MusS) - * @author trabis <lus...@gm...> - * @package system - * @subpackage preferences - * @version $Id$ - */ - -defined('XOOPS_ROOT_PATH') or die('Restricted access'); - -class SystemModulepreferenceForm extends XoopsSimpleForm -{ - /** - * @param null $obj - */ - public function __construct($obj = null) - { - } - - /** - * @param $obj - * @param XoopsModule|XoopsObject $mod - * - * @return void - */ - public function getForm(&$obj, XoopsModule &$mod) - { - $xoops = Xoops::getInstance(); - $config_handler = $xoops->getHandlerConfig(); - - parent::__construct('', 'pref_form', 'admin.php?fct=preferences', 'post', true); - if ($mod->getVar('dirname') != 'system') { - $xoops->loadLanguage('modinfo', $mod->getVar('dirname')); - } - $configs = $mod->getInfo('config'); - $configNames = array(); - foreach (array_keys($configs) as $i) { - $configNames[$configs[$i]['name']] =& $configs[$i]; - } - $configCats = $mod->getInfo('configcat'); - if (!$configCats) { - $configCats = array( - 'default' => array( - 'name' => _MD_AM_MODCONFIG, 'description' => '' - ) - ); - } - - if (!in_array('default', array_keys($configCats))) { - $configCats['default'] = array( - 'name' => _MD_AM_MODCONFIG, 'description' => '' - ); - } - - foreach (array_keys($configNames) as $name) { - if (!isset($configNames[$name]['category'])) { - $configNames[$name]['category'] = 'default'; - } - } - - $tabtray = new XoopsFormTabTray('', 'pref_tabtay', $xoops->getModuleConfig('jquery_theme', 'system')); - $tabs = array(); - foreach ($configCats as $name => $info) { - $tabs[$name] = new XoopsFormTab($info['name'], 'pref_tab_' . $name); - if (isset($info['description']) && $info['description'] != '') { - $tabs[$name]->addElement(new XoopsFormLabel('', $info['description'])); - } - } - - // if has comments feature, need comment lang file - if ($mod->getVar('hascomments') == 1) { - $xoops->loadLanguage('comment'); - } - // RMV-NOTIFY - // if has notification feature, need notification lang file - if ($mod->getVar('hasnotification') == 1) { - $xoops->loadLanguage('notification'); - } - - //$modname = $module->getVar('name'); - if (!empty($_REQUEST["redirect"])) { - $myts = MyTextSanitizer::getInstance(); - $this->addElement(new XoopsFormHidden('redirect', $myts->htmlspecialchars($_REQUEST["redirect"]))); - } elseif ($mod->getInfo('adminindex')) { - $this->addElement(new XoopsFormHidden('redirect', XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('adminindex'))); - } - $count = count($obj); - for ($i = 0; $i < $count; $i++) { - $title = constant($obj[$i]->getVar('conf_title')); - $desc = ($obj[$i]->getVar('conf_desc') != '') ? constant($obj[$i]->getVar('conf_desc')) : ''; - switch ($obj[$i]->getVar('conf_formtype')) { - - case 'textarea': - $myts = MyTextSanitizer::getInstance(); - if ($obj[$i]->getVar('conf_valuetype') == 'array') { - // this is exceptional.. only when value type is arrayneed a smarter way for this - $ele = ($obj[$i]->getVar('conf_value') != '') ? new XoopsFormTextArea($title, $obj[$i]->getVar('conf_name'), $myts->htmlspecialchars(implode('|', $obj[$i]->getConfValueForOutput())), 5, 5) : new XoopsFormTextArea($title, $obj[$i]->getVar('conf_name'), '', 5, 5); - } else { - $ele = new XoopsFormTextArea($title, $obj[$i]->getVar('conf_name'), $myts->htmlspecialchars($obj[$i]->getConfValueForOutput()), 5, 5); - } - break; - - case 'select': - $ele = new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); - $options = $config_handler->getConfigOptions(new Criteria('conf_id', $obj[$i]->getVar('conf_id'))); - $opcount = count($options); - for ($j = 0; $j < $opcount; $j++) { - $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); - $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); - $ele->addOption($optval, $optkey); - } - break; - - case 'select_multi': - $ele = new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput(), 5, true); - $options = $config_handler->getConfigOptions(new Criteria('conf_id', $obj[$i]->getVar('conf_id'))); - $opcount = count($options); - for ($j = 0; $j < $opcount; $j++) { - $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); - $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); - $ele->addOption($optval, $optkey); - } - break; - - case 'yesno': - $ele = new XoopsFormRadioYN($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput(), _YES, _NO); - break; - - case 'theme': - case 'theme_multi': - $ele = ($obj[$i]->getVar('conf_formtype') != 'theme_multi') ? new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()) : new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput(), 5, true); - $dirlist = XoopsLists::getThemesList(); - if (!empty($dirlist)) { - asort($dirlist); - $ele->addOptionArray($dirlist); - } - break; - case 'tplset': - $ele = new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); - $tplset_handler = $xoops->getHandlerTplset(); - $tplsetlist = $tplset_handler->getNameList(); - asort($tplsetlist); - foreach ($tplsetlist as $key => $name) { - $ele->addOption($key, $name); - } - break; - - case 'cpanel': - $ele = new XoopsFormHidden($obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); - /* - $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); - XoopsLoad::load("cpanel", "system"); - $list = XoopsSystemCpanel::getGuis(); - $ele->addOptionArray($list); */ - break; - - case 'timezone': - $ele = new XoopsFormSelectTimezone($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); - break; - - case 'language': - $ele = new XoopsFormSelectLang($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); - break; - - case 'startpage': - $ele = new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); - - $module_handler = $xoops->getHandlerModule(); - $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); - $criteria->add(new Criteria('isactive', 1)); - $moduleslist = $module_handler->getNameList($criteria, true); - $moduleslist['--'] = _MD_AM_NONE; - $ele->addOptionArray($moduleslist); - break; - - case 'group': - $ele = new XoopsFormSelectGroup($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 1, false); - break; - - case 'group_multi': - $ele = new XoopsFormSelectGroup($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 5, true); - break; - - // RMV-NOTIFY: added 'user' and 'user_multi' - case 'user': - $ele = new XoopsFormSelectUser($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 1, false); - break; - - case 'user_multi': - $ele = new XoopsFormSelectUser($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 5, true); - break; - case 'module_cache': - $module_handler = $xoops->getHandlerModule(); - $modules = $module_handler->getObjectsArray(new Criteria('hasmain', 1), true); - $currrent_val = $obj[$i]->getConfValueForOutput(); - $cache_options = array( - '0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, - '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, - '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK - ); - if (count($modules) > 0) { - $ele = new XoopsFormElementTray($title, '<br />'); - foreach (array_keys($modules) as $mid) { - $c_val = isset($currrent_val[$mid]) ? intval($currrent_val[$mid]) : null; - $selform = new XoopsFormSelect($modules[$mid]->getVar('name'), $obj[$i]->getVar('conf_name') . "[$mid]", $c_val); - $selform->addOptionArray($cache_options); - $ele->addElement($selform); - unset($selform); - } - } else { - $ele = new XoopsFormLabel($title, _MD_AM_NOMODULE); - } - break; - - case 'site_cache': - $ele = new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); - $ele->addOptionArray(array( - '0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, - '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, - '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK - )); - break; - - case 'password': - $myts = MyTextSanitizer::getInstance(); - $ele = new XoopsFormPassword($title, $obj[$i]->getVar('conf_name'), 5, 255, $myts->htmlspecialchars($obj[$i]->getConfValueForOutput())); - break; - - case 'color': - $myts = MyTextSanitizer::getInstance(); - $ele = new XoopsFormColorPicker($title, $obj[$i]->getVar('conf_name'), $myts->htmlspecialchars($obj[$i]->getConfValueForOutput())); - break; - - case 'hidden': - $myts = MyTextSanitizer::getInstance(); - $ele = new XoopsFormHidden($obj[$i]->getVar('conf_name'), $myts->htmlspecialchars($obj[$i]->getConfValueForOutput())); - break; - - case 'textbox': - default: - $myts = MyTextSanitizer::getInstance(); - $ele = new XoopsFormText($title, $obj[$i]->getVar('conf_name'), 5, 255, $myts->htmlspecialchars($obj[$i]->getConfValueForOutput())); - break; - } - $hidden = new XoopsFormHidden('conf_ids[]', $obj[$i]->getVar('conf_id')); - if (isset($ele)) { - $ele->setDescription($desc); - if ($obj[$i]->getVar('conf_formtype') != 'hidden') { - $name = 'default'; - if (isset($configNames[$obj[$i]->getVar('conf_name')]['category'])) { - $name = $configNames[$obj[$i]->getVar('conf_name')]['category']; - } - $tabs[$name]->addElement($ele); - } else { - $this->addElement($ele); - } - $this->addElement($hidden); - unset($ele); - unset($hidden); - } - } - foreach (array_keys($tabs) as $name) { - if ($tabs[$name]->getElements()) { - $tabtray->addElement($tabs[$name]); - } - } - $this->addElement($tabtray); - $this->addElement(new XoopsFormHidden('op', 'save')); - $this->addElement(new XoopsFormButton('', 'button', _SUBMIT, 'submit')); - } -} Copied: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/class/form/preferences.php (from rev 10410, XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/class/form/modulepreference.php) =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/class/form/preferences.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/system/class/form/preferences.php 2012-12-16 19:09:38 UTC (rev 10413) @@ -0,0 +1,286 @@ +<?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. +*/ + +/** + * Preference Form Class + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @author Andricq Nicolas (AKA MusS) + * @author trabis <lus...@gm...> + * @package system + * @subpackage preferences + * @version $Id$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +class SystemPreferencesForm extends XoopsSimpleForm +{ + /** + * @param null $obj + */ + public function __construct($obj = null) + { + } + + /** + * @param $obj + * @param XoopsModule|XoopsObject $mod + * + * @return void + */ + public function getForm(&$obj, XoopsModule &$mod) + { + $xoops = Xoops::getInstance(); + $config_handler = $xoops->getHandlerConfig(); + + parent::__construct('', 'pref_form', 'admin.php?fct=preferences', 'post', true); + if ($mod->getVar('dirname') != 'system') { + $xoops->loadLanguage('modinfo', $mod->getVar('dirname')); + } + $configs = $mod->getInfo('config'); + $configNames = array(); + foreach (array_keys($configs) as $i) { + $configNames[$configs[$i]['name']] =& $configs[$i]; + } + $configCats = $mod->getInfo('configcat'); + if (!$configCats) { + $configCats = array( + 'default' => array( + 'name' => _MD_AM_MODCONFIG, 'description' => '' + ) + ); + } + + if (!in_array('default', array_keys($configCats))) { + $configCats['default'] = array( + 'name' => _MD_AM_MODCONFIG, 'description' => '' + ); + } + + foreach (array_keys($configNames) as $name) { + if (!isset($configNames[$name]['category'])) { + $configNames[$name]['category'] = 'default'; + } + } + + $tabtray = new XoopsFormTabTray('', 'pref_tabtay', $xoops->getModuleConfig('jquery_theme', 'system')); + $tabs = array(); + foreach ($configCats as $name => $info) { + $tabs[$name] = new XoopsFormTab($info['name'], 'pref_tab_' . $name); + if (isset($info['description']) && $info['description'] != '') { + $tabs[$name]->addElement(new XoopsFormLabel('', $info['description'])); + } + } + + // if has comments feature, need comment lang file + if ($mod->getVar('hascomments') == 1) { + $xoops->loadLanguage('comment'); + } + // RMV-NOTIFY + // if has notification feature, need notification lang file + if ($mod->getVar('hasnotification') == 1) { + $xoops->loadLanguage('notification'); + } + + //$modname = $module->getVar('name'); + if (!empty($_REQUEST["redirect"])) { + $myts = MyTextSanitizer::getInstance(); + $this->addElement(new XoopsFormHidden('redirect', $myts->htmlspecialchars($_REQUEST["redirect"]))); + } elseif ($mod->getInfo('adminindex')) { + $this->addElement(new XoopsFormHidden('redirect', XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('adminindex'))); + } + $count = count($obj); + for ($i = 0; $i < $count; $i++) { + $title = constant($obj[$i]->getVar('conf_title')); + $desc = ($obj[$i]->getVar('conf_desc') != '') ? constant($obj[$i]->getVar('conf_desc')) : ''; + switch ($obj[$i]->getVar('conf_formtype')) { + + case 'textarea': + $myts = MyTextSanitizer::getInstance(); + if ($obj[$i]->getVar('conf_valuetype') == 'array') { + // this is exceptional.. only when value type is arrayneed a smarter way for this + $ele = ($obj[$i]->getVar('conf_value') != '') ? new XoopsFormTextArea($title, $obj[$i]->getVar('conf_name'), $myts->htmlspecialchars(implode('|', $obj[$i]->getConfValueForOutput())), 5, 5) : new XoopsFormTextArea($title, $obj[$i]->getVar('conf_name'), '', 5, 5); + } else { + $ele = new XoopsFormTextArea($title, $obj[$i]->getVar('conf_name'), $myts->htmlspecialchars($obj[$i]->getConfValueForOutput()), 5, 5); + } + break; + + case 'select': + $ele = new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); + $options = $config_handler->getConfigOptions(new Criteria('conf_id', $obj[$i]->getVar('conf_id'))); + $opcount = count($options); + for ($j = 0; $j < $opcount; $j++) { + $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); + $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); + $ele->addOption($optval, $optkey); + } + break; + + case 'select_multi': + $ele = new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput(), 5, true); + $options = $config_handler->getConfigOptions(new Criteria('conf_id', $obj[$i]->getVar('conf_id'))); + $opcount = count($options); + for ($j = 0; $j < $opcount; $j++) { + $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); + $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); + $ele->addOption($optval, $optkey); + } + break; + + case 'yesno': + $ele = new XoopsFormRadioYN($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput(), _YES, _NO); + break; + + case 'theme': + case 'theme_multi': + $ele = ($obj[$i]->getVar('conf_formtype') != 'theme_multi') ? new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()) : new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput(), 5, true); + $dirlist = XoopsLists::getThemesList(); + if (!empty($dirlist)) { + asort($dirlist); + $ele->addOptionArray($dirlist); + } + break; + case 'tplset': + $ele = new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); + $tplset_handler = $xoops->getHandlerTplset(); + $tplsetlist = $tplset_handler->getNameList(); + asort($tplsetlist); + foreach ($tplsetlist as $key => $name) { + $ele->addOption($key, $name); + } + break; + + case 'cpanel': + $ele = new XoopsFormHidden($obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); + /* + $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); + XoopsLoad::load("cpanel", "system"); + $list = XoopsSystemCpanel::getGuis(); + $ele->addOptionArray($list); */ + break; + + case 'timezone': + $ele = new XoopsFormSelectTimezone($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); + break; + + case 'language': + $ele = new XoopsFormSelectLang($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); + break; + + case 'startpage': + $ele = new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); + + $module_handler = $xoops->getHandlerModule(); + $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); + $criteria->add(new Criteria('isactive', 1)); + $moduleslist = $module_handler->getNameList($criteria, true); + $moduleslist['--'] = _MD_AM_NONE; + $ele->addOptionArray($moduleslist); + break; + + case 'group': + $ele = new XoopsFormSelectGroup($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 1, false); + break; + + case 'group_multi': + $ele = new XoopsFormSelectGroup($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 5, true); + break; + + // RMV-NOTIFY: added 'user' and 'user_multi' + case 'user': + $ele = new XoopsFormSelectUser($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 1, false); + break; + + case 'user_multi': + $ele = new XoopsFormSelectUser($title, $obj[$i]->getVar('conf_name'), false, $obj[$i]->getConfValueForOutput(), 5, true); + break; + case 'module_cache': + $module_handler = $xoops->getHandlerModule(); + $modules = $module_handler->getObjectsArray(new Criteria('hasmain', 1), true); + $currrent_val = $obj[$i]->getConfValueForOutput(); + $cache_options = array( + '0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, + '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, + '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK + ); + if (count($modules) > 0) { + $ele = new XoopsFormElementTray($title, '<br />'); + foreach (array_keys($modules) as $mid) { + $c_val = isset($currrent_val[$mid]) ? intval($currrent_val[$mid]) : null; + $selform = new XoopsFormSelect($modules[$mid]->getVar('name'), $obj[$i]->getVar('conf_name') . "[$mid]", $c_val); + $selform->addOptionArray($cache_options); + $ele->addElement($selform); + unset($selform); + } + } else { + $ele = new XoopsFormLabel($title, _MD_AM_NOMODULE); + } + break; + + case 'site_cache': + $ele = new XoopsFormSelect($title, $obj[$i]->getVar('conf_name'), $obj[$i]->getConfValueForOutput()); + $ele->addOptionArray(array( + '0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, + '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, + '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK + )); + break; + + case 'password': + $myts = MyTextSanitizer::getInstance(); + $ele = new XoopsFormPassword($title, $obj[$i]->getVar('conf_name'), 5, 255, $myts->htmlspecialchars($obj[$i]->getConfValueForOutput())); + break; + + case 'color': + $myts = MyTextSanitizer::getInstance(); + $ele = new XoopsFormColorPicker($title, $obj[$i]->getVar('conf_name'), $myts->htmlspecialchars($obj[$i]->getConfValueForOutput())); + break; + + case 'hidden': + $myts = MyTextSanitizer::getInstance(); + $ele = new XoopsFormHidden($obj[$i]->getVar('conf_name'), $myts->htmlspecialchars($obj[$i]->getConfValueForOutput())); + break; + + case 'textbox': + default: + $myts = MyTextSanitizer::getInstance(); + $ele = new XoopsFormText($title, $obj[$i]->getVar('conf_name'), 5, 255, $myts->htmlspecialchars($obj[$i]->getConfValueForOutput())); + break; + } + $hidden = new XoopsFormHidden('conf_ids[]', $obj[$i]->getVar('conf_id')); + if (isset($ele)) { + $ele->setDescription($desc); + if ($obj[$i]->getVar('conf_formtype') != 'hidden') { + $name = 'default'; + if (isset($configNames[$obj[$i]->getVar('conf_name')]['category'])) { + $name = $configNames[$obj[$i]->getVar('conf_name')]['category']; + } + $tabs[$name]->addElement($ele); + } else { + $this->addElement($ele); + } + $this->addElement($hidden); + unset($ele); + unset($hidden); + } + } + foreach (array_keys($tabs) as $name) { + if ($tabs[$name]->getElements()) { + $tabtray->addElement($tabs[$name]); + } + } + $this->addElement($tabtray); + $this->addElement(new XoopsFormHidden('op', 'save')); + $this->addElement(new XoopsFormButton('', 'button', _SUBMIT, 'submit')); + } +} |