예제 #1
0
 function BoxchooserSettingsForm()
 {
     parent::MailForm();
     page_title(intl_get('Box Settings'));
     //set(array('title'=>'Add a Box'));
     global $cgi;
     //set
     if (!$cgi->box) {
         echo 'Missing parameter: box';
         exit;
     }
     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'));
     $this->_box_settings = ini_parse('inc/app/' . $cgi->app . '/boxes/' . $cgi->box . '/settings.php');
     ini_clear();
     unset($this->_box_settings['Meta']);
     if (count($this->_box_settings) === 0) {
         $this->onSubmit((array) $cgi);
         return;
     }
     foreach ($this->_box_settings as $k => $v) {
         $this->createWidget($k, $v);
     }
     $this->addWidget('hidden', 'app');
     $this->addWidget('hidden', 'box');
     $this->addWidget('hidden', 'name');
     $w =& $this->addWidget('submit', 'sub');
     $w->setValues(intl_get('Done'));
 }
예제 #2
0
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);
$w =& $form->addWidget('template', 'tpl');
$w->template = 'properties.spt';
$w =& $form->addWidget('msubmit', 'submit_button');
$b1 =& $w->getButton();
$b1->setValues(intl_get('OK'));
예제 #3
0
 function _settings($file, $data)
 {
     if (!@file_exists($file)) {
         return true;
     }
     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'));
     $data = ini_parse($file);
     ini_clear();
     if (!is_array($data)) {
         return true;
     }
     if (count($data) == 0) {
         return true;
     }
     foreach ($data as $section => $values) {
         foreach ($values as $k => $v) {
             if ($section == 'Form' && ($k == 'title' || $k == 'message')) {
                 $this->buffer->set($this->intl->serialize($v), array('string' => $v, 'params' => false, 'file' => $file, 'line' => false));
             } elseif ($k == 'alt' || $k == 'display_value' || $k == 'title') {
                 $this->buffer->set($this->intl->serialize($v), array('string' => $v, 'params' => false, 'file' => $file, 'line' => false));
             } elseif (strpos($k, 'rule ') === 0 && is_array($v)) {
                 $this->buffer->set($this->intl->serialize($v[1]), array('string' => $v[1], 'params' => false, 'file' => $file, 'line' => false));
             } elseif (strpos($k, 'button ') === 0) {
                 if (is_array($v)) {
                     $v = $v[0];
                 }
                 $this->buffer->set($this->intl->serialize($v), array('string' => $v, 'params' => false, 'file' => $file, 'line' => false));
             } elseif (strpos($v, 'eval:') === 0) {
                 $this->_php($file, OPEN_TAG . ' ' . substr($v, 5) . ' ' . CLOSE_TAG);
             }
         }
     }
     return true;
 }
예제 #4
0
 /**
  * Parses the specified file using the parse_ini_file()
  * function.  Sections in the file correspond to the names of
  * widgets you wish to create, in addition to a [Form] section
  * that sets properties for the form itself.  The values in
  * each section correspond to properties or methods of the
  * widgets.  This method can be used to simplify the process
  * of defining and customizing a form.
  * 
  * @access	public
  * @param	string	$file
  * @return	boolean
  * 
  */
 function parseSettings($file)
 {
     if (!@file_exists($file)) {
         return false;
     }
     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'));
     $conf = ini_parse($file, true);
     ini_clear();
     if (count($conf) == 0) {
         return false;
     }
     // form properties, optional
     if (is_array($conf['Form'])) {
         foreach ($conf['Form'] as $key => $value) {
             if (($key == 'title' || $key == 'message') && function_exists('intl_get')) {
                 $value = intl_get($value);
             }
             $this->{$key} = $value;
         }
         unset($conf['Form']);
     }
     foreach ($conf as $name => $data) {
         $this->createWidget($name, $data);
     }
     return true;
 }