forked from science-ation/science-ation
- Change the user editor, read the fields and required fields from a config
variable, this will allow the committee to specify exactly what they wish to collect (and which fields are requried) - Insert config variables for volunteers and committee
This commit is contained in:
parent
9eca885410
commit
55983aca38
@ -1 +1 @@
|
|||||||
67
|
68
|
||||||
|
35
db/db.update.68.sql
Normal file
35
db/db.update.68.sql
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
ALTER TABLE `users` ADD `birthdate` DATE NOT NULL AFTER `organization` ;
|
||||||
|
ALTER TABLE `users` ADD `lang` VARCHAR( 2 ) NOT NULL AFTER `birthdate` ;
|
||||||
|
ALTER TABLE `users` ADD `sex` ENUM( 'male', 'female' ) NOT NULL AFTER `lastname` ;
|
||||||
|
|
||||||
|
INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year` )
|
||||||
|
VALUES (
|
||||||
|
'volunteer_personal_fields', 'phonehome,phonecell,org',
|
||||||
|
'Volunteer Registration', 'multisel',
|
||||||
|
'sex=Gender|phonehome=Home Phone|phonework=Work Phone|phonecell=Cell Phone|fax=Fax|org=Organization|birthdate=Birthdate|lang=Preferred Language|address=Address and PostalCode|city=City|province=Province',
|
||||||
|
'500', 'Personal Information to ask for on the Volunteer personal information page (in addition to Name and Email)', '-1');
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year` )
|
||||||
|
VALUES (
|
||||||
|
'volunteer_personal_required', '',
|
||||||
|
'Volunteer Registration', 'multisel',
|
||||||
|
'sex=Gender|phonehome=Home Phone|phonework=Work Phone|phonecell=Cell Phone|fax=Fax|org=Organization|birthdate=Birthdate|lang=Preferred Language|address=Address and PostalCode|city=City|province=Province',
|
||||||
|
'600', 'Required Personal Information on the Volunteer personal information page (Name and Email is always required)', '-1');
|
||||||
|
|
||||||
|
INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year` )
|
||||||
|
VALUES (
|
||||||
|
'committee_personal_fields', 'phonehome,phonecell,phonework,fax,org',
|
||||||
|
'Committee Members', 'multisel',
|
||||||
|
'sex=Gender|phonehome=Home Phone|phonework=Work Phone|phonecell=Cell Phone|fax=Fax|org=Organization|birthdate=Birthdate|lang=Preferred Language|address=Address and PostalCode|city=City|province=Province',
|
||||||
|
'500', 'Personal Information to ask for on the Committee Member profile page (in addition to Name and Email)', '-1');
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year` )
|
||||||
|
VALUES (
|
||||||
|
'committee_personal_required', '',
|
||||||
|
'Committee Members', 'multisel',
|
||||||
|
'sex=Gender|phonehome=Home Phone|phonework=Work Phone|phonecell=Cell Phone|fax=Fax|org=Organization|birthdate=Birthdate|lang=Preferred Language|address=Address and PostalCode|city=City|province=Province',
|
||||||
|
'600', 'Required Personal Information on the Committee Member profile page (Name and Email is always required)', '-1');
|
||||||
|
|
||||||
|
|
73
user.inc.php
73
user.inc.php
@ -408,51 +408,47 @@ function user_judge_registration_status()
|
|||||||
return "open";
|
return "open";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user_personal_fields_map = array(
|
||||||
|
'name' => array('firstname','lastname'),
|
||||||
|
'email' => array('email'),
|
||||||
|
'sex' => array('sex'),
|
||||||
|
'phonehome' => array('phonehome'),
|
||||||
|
'phonework' => array('phonework'),
|
||||||
|
'phonecell' => array('phonecell'),
|
||||||
|
'fax' => array('fax'),
|
||||||
|
'org' => array('organization'),
|
||||||
|
'birthdate' => array('birthdate'),
|
||||||
|
'lang' => array('lang'),
|
||||||
|
'address' => array('address', 'address2', 'postalcode'),
|
||||||
|
'city' => array('city'),
|
||||||
|
'province' => array('province'));
|
||||||
|
|
||||||
function user_personal_fields($type)
|
function user_personal_fields($type)
|
||||||
{
|
{
|
||||||
/* Figure out what fields we should show. */
|
global $config, $user_personal_fields_map;
|
||||||
$all_fields = array('firstname','lastname','email','phonehome','phonecell','organization');
|
$ret = array('firstname','lastname','email');
|
||||||
switch($type) {
|
$fields = $config["{$type}_personal_fields"];
|
||||||
case 'volunteer':
|
if($fields != '') {
|
||||||
$f = array();
|
$fields = split(',', $fields);
|
||||||
break;
|
foreach($fields as $f) {
|
||||||
case 'committee':
|
$ret = array_merge($ret, $user_personal_fields_map[$f]);
|
||||||
$f = array('phonework','fax');
|
}
|
||||||
break;
|
|
||||||
case 'judge':
|
|
||||||
$f = array();
|
|
||||||
break;
|
|
||||||
case 'student':
|
|
||||||
$f = array();
|
|
||||||
break;
|
|
||||||
case 'region':
|
|
||||||
$f = array();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return array_merge($all_fields, $f);
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function user_personal_required_fields($type)
|
function user_personal_required_fields($type)
|
||||||
{
|
{
|
||||||
$all_fields = array('firstname','lastname','email');
|
global $config, $user_personal_fields_map;
|
||||||
switch($type) {
|
$ret = array('firstname','lastname','email');
|
||||||
case 'volunteer':
|
$required = $config["{$type}_personal_required"];
|
||||||
$f = array();
|
if($required != '') {
|
||||||
break;
|
$fields = split(',', $required);
|
||||||
case 'committee':
|
foreach($fields as $f) {
|
||||||
$f = array();
|
$ret = array_merge($ret, $user_personal_fields_map[$f]);
|
||||||
break;
|
}
|
||||||
case 'judge':
|
|
||||||
$f = array();
|
|
||||||
break;
|
|
||||||
case 'student':
|
|
||||||
$f = array();
|
|
||||||
break;
|
|
||||||
case 'region':
|
|
||||||
$f = array();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return array_merge($all_fields, $f);
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function user_personal_info_status($u = false)
|
function user_personal_info_status($u = false)
|
||||||
@ -462,7 +458,8 @@ function user_personal_info_status($u = false)
|
|||||||
}
|
}
|
||||||
$required = array();
|
$required = array();
|
||||||
foreach($u['types'] as $t) {
|
foreach($u['types'] as $t) {
|
||||||
$required = array_merge($required, user_personal_required_fields($t));
|
$required = array_merge($required,
|
||||||
|
user_personal_required_fields($t));
|
||||||
}
|
}
|
||||||
foreach($required as $r) {
|
foreach($required as $r) {
|
||||||
$val = trim($u[$r]);
|
$val = trim($u[$r]);
|
||||||
|
@ -54,21 +54,20 @@
|
|||||||
$fields = array();
|
$fields = array();
|
||||||
$required = array();
|
$required = array();
|
||||||
foreach($u['types'] as $t) {
|
foreach($u['types'] as $t) {
|
||||||
$fields = array_merge($fields,
|
$fields = array_merge($fields,
|
||||||
user_personal_fields($t));
|
user_personal_fields($t));
|
||||||
$required = array_merge($required,
|
$required = array_merge($required,
|
||||||
user_personal_required_fields($t));
|
user_personal_required_fields($t));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(committee_auth_has_access('super')) {
|
if(committee_auth_has_access('super')) {
|
||||||
/* If the editer is super, let them see/edit/save the password */
|
/* If the editer is super, let them see/edit/save the user/pass */
|
||||||
|
$fields[] = 'username';
|
||||||
$fields[] = 'password';
|
$fields[] = 'password';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_POST['action']=="save")
|
if($_POST['action']=="save")
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/* Set values */
|
/* Set values */
|
||||||
foreach($fields as $f) {
|
foreach($fields as $f) {
|
||||||
$u[$f] = mysql_escape_string(stripslashes($_POST[$f]));
|
$u[$f] = mysql_escape_string(stripslashes($_POST[$f]));
|
||||||
@ -157,7 +156,7 @@ function item($user, $text, $fname)
|
|||||||
global $fields, $required;
|
global $fields, $required;
|
||||||
|
|
||||||
if(in_array($fname, $fields)) {
|
if(in_array($fname, $fields)) {
|
||||||
echo '<td>'.i18n($text).'</td>';
|
echo '<td>'.i18n($text).': </td>';
|
||||||
echo "<td><input onchange=\"fieldChanged()\" type=\"text\" name=\"$fname\" value=\"{$user[$fname]}\" />";
|
echo "<td><input onchange=\"fieldChanged()\" type=\"text\" name=\"$fname\" value=\"{$user[$fname]}\" />";
|
||||||
if(in_array($fname, $required)) echo REQUIREDFIELD;
|
if(in_array($fname, $required)) echo REQUIREDFIELD;
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
@ -181,6 +180,10 @@ item($u, "Last Name", 'lastname');
|
|||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
item($u, "Email Address", 'email');
|
item($u, "Email Address", 'email');
|
||||||
|
echo '<td></td><td></td>';
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo "<tr>\n";
|
||||||
|
item($u, "Username", 'username');
|
||||||
item($u, "Password", 'password');
|
item($u, "Password", 'password');
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
@ -190,7 +193,7 @@ echo "</tr>\n";
|
|||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
item($u, "City", 'city');
|
item($u, "City", 'city');
|
||||||
if(in_array('province', $fields)) {
|
if(in_array('province', $fields)) {
|
||||||
echo '<td>'.i18n('Province').'</td>';
|
echo '<td>'.i18n('Province').': </td>';
|
||||||
echo '<td>';
|
echo '<td>';
|
||||||
emit_province_selector("province",$judgeinfo->province,"onchange=\"fieldChanged()\"");
|
emit_province_selector("province",$judgeinfo->province,"onchange=\"fieldChanged()\"");
|
||||||
if(in_array('province', $required)) echo REQUIREDFIELD;
|
if(in_array('province', $required)) echo REQUIREDFIELD;
|
||||||
@ -223,9 +226,7 @@ echo "</table>";
|
|||||||
|
|
||||||
/* Committee specific fields */
|
/* Committee specific fields */
|
||||||
if(in_array('committee', $u['types'])) {
|
if(in_array('committee', $u['types'])) {
|
||||||
echo "<table><tr>\n";
|
echo "<table>";
|
||||||
item($u, "Email (Private)", 'emailprivate');
|
|
||||||
echo "</tr>";
|
|
||||||
|
|
||||||
echo "<tr><td>".i18n("Email (Private)").":</td><td><input size=\"25\" type=\"text\" name=\"emailprivate\" value=\"{$u['emailprivate']}\" /></td></tr>\n";
|
echo "<tr><td>".i18n("Email (Private)").":</td><td><input size=\"25\" type=\"text\" name=\"emailprivate\" value=\"{$u['emailprivate']}\" /></td></tr>\n";
|
||||||
echo "<tr><td>".i18n("Display Emails").":</td><td>";
|
echo "<tr><td>".i18n("Display Emails").":</td><td>";
|
||||||
|
Loading…
Reference in New Issue
Block a user