Exemplo n.º 1
0
global $cgi;
loader_import('saf.MailForm');
$form = new MailForm();
$w =& $form->addWidget('hidden', 'appname');
$w->setValue($parameters['appname']);
foreach ($settings as $k => $v) {
    if (!isset($v['type'])) {
        $v['type'] = 'text';
    }
    if (isset($v['value'])) {
        $val = $v['value'];
        unset($v['value']);
    } else {
        $val = false;
    }
    $w =& $form->createWidget($k, $v);
    if ($val) {
        $w->setValue($val);
    }
}
$sub =& $form->addWidget('msubmit', 'submit_button');
$b1 =& $sub->getButton();
$b1->setValues(intl_get('Save'));
$b2 =& $sub->addbutton('submit_button', intl_get('Cancel'));
$b2->extra = 'onclick="window.location.href = \'' . site_prefix() . '/index/usradm-applications-action\'; return false"';
if ($form->invalid($cgi)) {
    $form->setValues($cgi);
    echo $form->show();
} else {
    $vals = $form->getValues();
    foreach ($vals as $k => $v) {
Exemplo n.º 2
0
    $attrs = array_merge($attrs, $defaults);
}
$css = new CSS_Parser();
$classes = array();
$ids = array();
foreach (Dir::find('*.css', 'inc/html/' . conf('Server', 'default_template_set')) as $file) {
    $css->parse(@join('', @file($file)));
    $classes = array_merge($classes, $css->getClasses($cgi->tag));
    $ids = array_merge($ids, $css->getIDs($cgi->tag));
}
$classes = array_unique($classes);
$ids = array_unique($ids);
$form = new MailForm();
ini_add_filter('ini_filter_split_comma_single', array('rule 0', 'rule 1', 'rule 2', 'rule 3', 'rule 4', 'rule 5', 'rule 6', 'rule 7', 'rule 8', 'button 0', 'button 1', 'button 2', 'button 3', 'button 4', 'button 5', 'button 6', 'button 7', 'button 8', 'submitButtons'));
foreach ($attrs as $attr) {
    $w =& $form->createWidget($attr->name, ini_parse($attr->typedef, false));
    if (isset($cgi->{$attr->name})) {
        $w->setDefault($cgi->{$attr->name});
    }
}
ini_clear();
if (isset($form->widgets['id'])) {
    $form->widgets['id']->setValues(array_merge(array('' => '- ' . intl_get('SELECT') . ' -'), assocify($ids)));
}
if (isset($form->widgets['class'])) {
    $form->widgets['class']->setValues(array_merge(array('' => '- ' . intl_get('SELECT') . ' -'), assocify($classes)));
}
$w =& $form->addWidget('hidden', 'ifname');
$w->setValue($cgi->ifname);
$w =& $form->addWidget('hidden', 'tag');
$w->setValue($cgi->tag);