diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2008-11-15 06:23:09 +0000 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2008-11-15 06:23:09 +0000 |
| commit | ae7839ffaada72c522ffcd9b3f4f1cc04027a720 (patch) | |
| tree | 50ce67306eace68cd23c294fc1aa40ba32c03bcc /themes/default/views/form.html.php | |
| parent | 26c8772e16b0328358d23ee4c29f9b592e632b28 (diff) | |
Revise the user login code.
* Remove user registration link and popup from the theme; this
shouldn't be done in a popup. Use ajaxform to simplify the way
that we load the login popup.
* Create form.html.php, this is a template for Forge based forms.
* Move user validation rules into User_Model and let forms
populate the rules into their forms as useful.
* Undo r18688's changes regarding the REST code. We should never
accept a null resource, this breaks the REST abstraction.
* Change login and user controllers to use Forge which lets us delete
login.html.php and user.html.php since those now are generated by
the theme-owned form template
Diffstat (limited to 'themes/default/views/form.html.php')
| -rw-r--r-- | themes/default/views/form.html.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/themes/default/views/form.html.php b/themes/default/views/form.html.php new file mode 100644 index 00000000..bc8d1339 --- /dev/null +++ b/themes/default/views/form.html.php @@ -0,0 +1,54 @@ +<? +print($open); + +// Not sure what to do with these, but at least show that we received them. +if ($class) { + print "<!-- unused class in form.html.php: $class -->"; +} +if ($title) { + print "<!-- unused title in form.html.php: $title -->"; +} + +function DrawForm($inputs, $level=1) { + $error_messages = array(); + $prefix = str_repeat(" ", $level); + + foreach ($inputs as $input) { + if ($input->type == 'group') { + print "$prefix<fieldset>\n"; + print "$prefix <legend>$input->name</legend>\n"; + print "$prefix <ul>\n"; + DrawForm($input->inputs, $level + 2); + print "$prefix </ul>\n"; + print "$prefix</fieldset>\n"; + } else { + if ($input->error_messages()) { + $error_messages = array_merge($error_messages, $input->error_messages()); + print "$prefix<li class=\"gError\">\n"; + } else { + print "$prefix<li>\n"; + } + if ($input->label()) { + print $prefix . " " . $input->label() . "\n"; + } + print $prefix . " " . $input->render() . "\n"; + print "$prefix</li>\n"; + if ($input->message()) { + print "$prefix<li>\n"; + print $prefix . " " . $input->message() . "\n"; + print "$prefix</li>\n"; + } + } + } + if ($error_messages) { + print "$prefix <div class=\"gStatus gError\">\n"; + foreach ($error_messages as $message) { + print "<p class=\"gError\">$message<p>"; + } + print "$prefix </div>\n"; + } +} +DrawForm($inputs); + +print($close); +?> |
