function form($object) { $i18n = exponent_lang_loadFile('datatypes/addressbook_contact.php'); if (!defined('SYS_FORMS')) { require_once BASE . 'subsystems/forms.php'; } exponent_forms_initialize(); $form = new form(); if (!isset($object->id)) { $object->firstname = ''; $object->lastname = ''; $object->address1 = ''; $object->address2 = ''; $object->city = ''; $object->state = ''; $object->zip = ''; $object->country = ''; $object->email = ''; $object->phone = ''; $object->cell = ''; $object->fax = ''; $object->pager = ''; $object->notes = ''; $object->webpage = ''; } else { $form->meta('id', $object->id); } $form->register('firstname', $i18n['firstname'], new textcontrol($object->firstname)); $form->register('lastname', $i18n['lastname'], new textcontrol($object->lastname)); $form->register(null, '', new htmlcontrol('<hr size="1" />')); $form->register('address1', $i18n['address1'], new textcontrol($object->address1, 30)); $form->register('address2', $i18n['address2'], new textcontrol($object->address2, 30)); $form->register('city', $i18n['city'], new textcontrol($object->city)); $form->register('state', $i18n['state'], new textcontrol($object->state)); $form->register('zip', $i18n['zip'], new textcontrol($object->zip)); $form->register(null, '', new htmlcontrol('<hr size="1" />')); $form->register('email', $i18n['email'], new textcontrol($object->email)); $form->register('webpage', $i18n['webpage'], new textcontrol($object->webpage)); $form->register(null, '', new htmlcontrol('<hr size="1" />')); $form->register('phone', $i18n['phone'], new textcontrol($object->phone)); $form->register('cell', $i18n['cell'], new textcontrol($object->cell)); $form->register('fax', $i18n['fax'], new textcontrol($object->fax)); $form->register('pager', $i18n['pager'], new textcontrol($object->pager)); $form->register(null, '', new htmlcontrol('<hr size="1" />')); $form->register('notes', $i18n['notes'], new texteditorcontrol($object->notes, 12, 50)); $form->register(null, '', new htmlcontrol('<hr size="1" />')); $form->register('submit', '', new buttongroupcontrol($i18n['save'], '', $i18n['cancel'])); exponent_forms_cleanup(); return $form; }
function form($textitem = null) { $i18n = exponent_lang_loadFile('datatypes/textitem.php'); if (!defined('SYS_FORMS')) { include_once BASE . 'subsystems/forms.php'; } exponent_forms_initialize(); $form = new form(); if (!$textitem) { $textitem->text = ''; $form->meta('id', 0); } else { $form->meta('id', $textitem->id); } $form->register('text', $i18n['caption_text'], new htmleditorcontrol($textitem->text)); $form->register('submit', '', new buttongroupcontrol($i18n['save'], '', $i18n['cancel'])); exponent_forms_cleanup(); return $form; }
# Written and Designed by James Hunt # # This file is part of Exponent # # Exponent is free software; you can redistribute # it and/or modify it under the terms of the GNU # General Public License as published by the Free # Software Foundation; either version 2 of the # License, or (at your option) any later version. # # GPL: http://www.gnu.org/licenses/gpl.txt # ################################################## if (!defined('EXPONENT')) { exit(''); } $i18n = exponent_lang_loadFile('modules/LoginModule/actions/resetpass.php'); if (!defined('SYS_FORMS')) { include_once BASE . 'subsystems/forms.php'; } exponent_forms_initialize(); $form = new form(); $form->meta('module', 'LoginModule'); $form->meta('action', 'resetpass_send'); $form->register('username', $i18n['username'], new textcontrol()); $form->register('submit', '', new buttongroupcontrol($i18n['reset'])); $template = new template('LoginModule', '_form_resetpass', $loc); $template->assign('form_html', $form->toHTML()); $template->output(); exponent_forms_cleanup();
function exponent_config_configurationForm($configname, $database = false) { // $configname = "" for active config $this_i18n = exponent_lang_loadFile('subsystems/config.php'); if (is_readable(BASE . "conf/extensions")) { global $user; $options = exponent_config_parse($configname); if (!defined('SYS_FORMS')) { require_once BASE . 'subsystems/forms.php'; } exponent_forms_initialize(); $form = new form(); $form->register(null, '', new htmlcontrol('<a name="config_top"></a><h3>' . $this_i18n['form_title'] . '</h3>')); $form->register('configname', $this_i18n['profile'], new textcontrol($configname)); $form->register('activate', $this_i18n['activate'], new checkboxcontrol(!defined('CURRENTCONFIGNAME') || CURRENTCONFIGNAME == $configname)); $sections = array(); $dh = opendir(BASE . 'conf/extensions'); while (($file = readdir($dh)) !== false) { if (is_readable(BASE . 'conf/extensions/' . $file) && substr($file, -14, 14) == '.structure.php') { $arr = (include BASE . 'conf/extensions/' . $file); // Check to see if the current user is a super admin, and only include database if so if (substr($file, 0, -14) != 'database' || $user->is_admin == 1) { $form->register(null, '', new htmlcontrol('<a name="config_' . count($sections) . '"></a><div style="font-weight: bold; margin-top: 1.5em; border-top: 1px solid black; border-bottom: 1px solid black; background-color: #ccc; font-size: 12pt;">' . $arr[0] . '</div><a href="#config_top">Top</a>')); $sections[] = '<a href="#config_' . count($sections) . '">' . $arr[0] . '</a>'; foreach ($arr[1] as $directive => $info) { if ($info['description'] != '') { $form->register(null, '', new htmlcontrol('<br /><br />' . $info['description'], false)); } if (is_a($info['control'], "checkboxcontrol")) { $form->meta("opts[{$directive}]", 1); $info['control']->default = $options[$directive]; $info['control']->flip = true; $form->register("o[{$directive}]", '<b>' . $info['title'] . '</b>', $info['control']); } else { if (isset($options[$directive])) { $info["control"]->default = $options[$directive]; } $form->register("c[{$directive}]", '<b>' . $info['title'] . '</b>', $info['control'], $info['description']); } } //$form->register(null,'',new buttongroupcontrol($this_i18n['save'],'',$this_i18n['cancel'])); } } } $form->registerAfter('activate', null, '', new htmlcontrol('<hr size="1" />' . implode(' | ', $sections))); $form->register('submit', '', new buttongroupcontrol($this_i18n['save'], '', $this_i18n['cancel'])); exponent_forms_cleanup(); return $form; } }