diff --git a/include/class.forms.php b/include/class.forms.php index f10b8b9343a02bb67afdf144a5369b99fca519e5..b101009c42239d20e358a75ec799fd67b50f312d 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -411,6 +411,10 @@ class FormField { return (($this->get('flags') & DynamicFormField::FLAG_EXT_STORED) == 0); } + function isRequired() { + return $this->get('required'); + } + /** * parse * diff --git a/include/staff/plugin.inc.php b/include/staff/plugin.inc.php index f27e21333aabc78535863ccb2e9c403851ac8a01..4b9726a3761f3f06267badf79fc160fe3c652fd4 100644 --- a/include/staff/plugin.inc.php +++ b/include/staff/plugin.inc.php @@ -29,12 +29,8 @@ $info = Format::htmlchars(($errors && $_POST) ? $_POST : $info); <?php if ($page) $config->renderCustomConfig(); -elseif ($form) { ?> - <table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2"> - <tbody> -<?php $form->render(); ?> - </tbody></table> -<?php +elseif ($form) { + include STAFFINC_DIR . 'templates/simple-form.tmpl.php'; } else { ?> <tr><th><?php echo __('This plugin has no configurable settings'); ?><br> diff --git a/include/staff/templates/simple-form.tmpl.php b/include/staff/templates/simple-form.tmpl.php new file mode 100644 index 0000000000000000000000000000000000000000..2191e474de62a90d55e15ceb5ac9a3ed691e9272 --- /dev/null +++ b/include/staff/templates/simple-form.tmpl.php @@ -0,0 +1,48 @@ +<?php if ($form->getTitle()) { ?> + <h1><strong><?php echo Format::htmlchars($form->getTitle()); ?></strong>: + <div><small><?php echo Format::htmlchars($form->getInstructions()); ?></small></div> + </h1> + <?php + } + foreach ($form->getFields() as $field) { ?> + <div class="form-field"><?php + if (!$field->isBlockLevel()) { ?> + <div class="<?php if ($field->isRequired()) echo 'required'; + ?>" style="display:inline-block;width:260px;"> + <?php echo Format::htmlchars($field->getLocal('label')); ?>: + <?php if ($field->isRequired()) { ?> + <span class="error">*</span> + <?php + } + if ($field->get('hint')) { ?> + <div class="faded hint"><?php + echo Format::htmlchars($field->getLocal('hint')); + ?></div> +<?php } ?> + </div> + <div style="display:inline-block;max-width:700px"><?php + } + $field->render($options); + foreach ($field->errors() as $e) { ?> + <div class="error"><?php echo Format::htmlchars($e); ?></div> + <?php } + if (!$field->isBlockLevel()) { ?> + </div> + <?php } ?> + </div> +<?php } ?> +<style type="text/css"> +.form-field div { + vertical-align: top; +} +.form-field div + div { + padding-left: 10px; +} +.form-field .hint { + font-size: 95%; +} +.form-field { + margin-top: 5px; + padding: 5px 0; +} +</style>