X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fsites%2Fsite_form.php;h=88cc490e22a849219994e1b34a35bcd09066f08c;hb=621f5f2521d88af260fe7b4ed416826662929669;hp=e77d78173200f9efb42b35a1beacb8930c8e3f26;hpb=05411893eee11af861e93000f4064d9a6ea23455;p=plewww.git diff --git a/planetlab/sites/site_form.php b/planetlab/sites/site_form.php index e77d781..88cc490 100644 --- a/planetlab/sites/site_form.php +++ b/planetlab/sites/site_form.php @@ -9,38 +9,21 @@ function build_site_form ($register_mode) { $form = array(); $form['site:name'] = array('title' => 'Site name', 'required' => TRUE, 'maxlength' => 40, 'size' => 20, - 'comment' => 'Site Information:'); + 'comment' => 'Site Information'); $form['site:login_base'] = array('title' => 'Login base', 'required' => TRUE, 'maxlength' => 16, 'size' => 10); $form['site:abbreviated_name'] = array('title' => 'Abbreviated name', 'required' => TRUE, - 'maxlength' => 20, 'size' => 12); + 'maxlength' => 40, 'size' => 20); $form['site:url'] = array('title' => 'URL', 'required' => TRUE, - 'maxlength' => 30, 'size' => 30); - $form['site:latitude'] = array('title' => 'Latitude', 'required' => FALSE, + 'maxlength' => 128, 'size' => 30); + $form['site:latitude'] = array('title' => 'Latitude', 'required' => TRUE, 'maxlength' => 10, 'size' => 10, 'type' => 'double'); - $form['site:longitude'] = array('title' => 'Longitude', 'required' => FALSE, + $form['site:longitude'] = array('title' => 'Longitude', 'required' => TRUE, 'maxlength' => 10, 'size' => 10, 'type' => 'double'); - $form['address:line1'] = array('title' => 'Address', 'required' => TRUE, - 'maxlength' => 40, 'size' => 30, - 'comment' => 'Postal address:'); - $form['address:line2'] = array('title' => 'Address (2)', 'required' => FALSE, - 'maxlength' => 40, 'size' => 30); - $form['address:line3'] = array('title' => 'Address (3)', 'required' => FALSE, - 'maxlength' => 40, 'size' => 30); - $form['address:city'] = array('title' => 'City', 'required' => TRUE, - 'maxlength' => 20, 'size' => 20); - $form['address:postalcode'] = array('title' => 'Postal Code', 'required' => TRUE, - 'maxlength' => 10, 'size' => 10); -# would have liked it *not* required but it is mandatory in the DB - sigh - $form['address:state'] = array('title' => 'State', 'required' => TRUE, - 'maxlength' => 20, 'size' => 20); - $form['address:country'] = array('title' => 'Country', 'required' => TRUE, - 'maxlength' => 20, 'size' => 20); - $form['pi:first_name'] = array('title' => 'PI First Name', 'required' => TRUE, 'maxlength' => 20, 'size' => 20, - 'comment' => 'Principal Investigator Information:'); + 'comment' => 'Principal Investigator Information'); $form['pi:last_name'] = array('title' => 'PI Last Name', 'required' => TRUE, 'maxlength' => 20, 'size' => 20); $form['pi:title'] = array('title' => 'PI Title', 'required' => FALSE, @@ -73,7 +56,7 @@ EOF; $form['tech:first_name'] = array('title' => 'Tech First Name', 'required' => TRUE, 'maxlength' => 20, 'size' => 20, - 'comment' => 'Technical Contact Information:' . $fill_from_pi_button); + 'comment' => 'Technical Contact Information' . $fill_from_pi_button); $form['tech:last_name'] = array('title' => 'Tech Last Name', 'required' => TRUE, 'maxlength' => 20, 'size' => 20); $form['tech:title'] = array('title' => 'Tech Title', 'required' => FALSE, @@ -88,6 +71,23 @@ EOF; $form['tech:user-role'] = array('type' => 'boolean', 'title' => 'Need user role', 'default' => TRUE); } + $form['address:line1'] = array('title' => 'Address', 'required' => FALSE, + 'maxlength' => 40, 'size' => 30, + 'comment' => 'Postal address'); + $form['address:line2'] = array('title' => 'Address (2)', 'required' => FALSE, + 'maxlength' => 40, 'size' => 30); + $form['address:line3'] = array('title' => 'Address (3)', 'required' => FALSE, + 'maxlength' => 40, 'size' => 30); + $form['address:city'] = array('title' => 'City', 'required' => FALSE, + 'maxlength' => 20, 'size' => 20); + $form['address:postalcode'] = array('title' => 'Postal Code', 'required' => FALSE, + 'maxlength' => 10, 'size' => 10); +# would have liked it *not* required but it is mandatory in the DB - sigh + $form['address:state'] = array('title' => 'State', 'required' => FALSE, + 'maxlength' => 20, 'size' => 20); + $form['address:country'] = array('title' => 'Country', 'required' => FALSE, + 'maxlength' => 20, 'size' => 20); + return $form; } @@ -108,7 +108,7 @@ function parse_form ($form, $request, $input = NULL) { // fill with values form the form foreach ($form as $fullname => $item) { - list($objname,$field) = split(":",$fullname); + list($objname,$field) = explode(":",$fullname); $raw_input=$request[$fullname]; if (!empty($raw_input)) { $empty_form = FALSE; @@ -161,7 +161,7 @@ function parse_form ($form, $request, $input = NULL) { function form_check_required ($form, $input) { $missing = array(); foreach ($form as $fullname => $item) { - list($objname,$field) = split(":",$fullname); + list($objname,$field) = explode(":",$fullname); if ($item['required'] && empty($input[$objname][$field])) { $missing[] = $item['title']; } @@ -184,7 +184,7 @@ function form_render_details ($details, $site_form, $input, $outline_missing) { foreach ($site_form as $fullname => $item) { - list($objname,$field) = split(":",$fullname); + list($objname,$field) = explode(":",$fullname); // render the comment field if ( ! empty($item['comment'])) {