forked from science-ation/science-ation
- Add support for short project titles in addition to the regular project
titles (defaults to off) - Renumber the order of the config variables in Participant Registration, it's getting a bit crowded - Fill in some missing types for config variables
This commit is contained in:
parent
8411d614d5
commit
78fa4ad6ac
@ -157,6 +157,12 @@ $report_students_fields = array(
|
||||
'width' => 2.75,
|
||||
'table' => 'projects.title' ),
|
||||
|
||||
'shorttitle' => array(
|
||||
'name' => 'Project -- Short Title',
|
||||
'header' => 'Short Title',
|
||||
'width' => 2,
|
||||
'table' => 'projects.shorttitle' ),
|
||||
|
||||
'division' => array(
|
||||
'name' => 'Project -- Division',
|
||||
'header' => 'Division',
|
||||
|
@ -1 +1 @@
|
||||
96
|
||||
97
|
||||
|
31
db/db.update.97.sql
Normal file
31
db/db.update.97.sql
Normal file
@ -0,0 +1,31 @@
|
||||
ALTER TABLE `projects` ADD `shorttitle` VARCHAR( 255 ) NOT NULL AFTER `title` ;
|
||||
|
||||
UPDATE `config` SET `ord`='500' WHERE `var`='regfee_show_info';
|
||||
UPDATE `config` SET `ord`='600',`type`='number' WHERE `var`='minage';
|
||||
UPDATE `config` SET `ord`='700',`type`='number' WHERE `var`='maxage';
|
||||
UPDATE `config` SET `ord`='800',`type`='number' WHERE `var`='mingrade';
|
||||
UPDATE `config` SET `ord`='900',`type`='number' WHERE `var`='maxgrade';
|
||||
UPDATE `config` SET `ord`='1000',`type`='number' WHERE `var`='minmentorsperproject';
|
||||
UPDATE `config` SET `ord`='1100',`type`='number' WHERE `var`='maxmentorsperproject';
|
||||
UPDATE `config` SET `ord`='1200',`type`='number' WHERE `var`='minstudentsperproject';
|
||||
UPDATE `config` SET `ord`='1300',`type`='number' WHERE `var`='maxstudentsperproject';
|
||||
UPDATE `config` SET `ord`='1400',`type`='number' WHERE `var`='maxspecialawardsperproject';
|
||||
UPDATE `config` SET `ord`='1500' WHERE `var`='participant_student_personal';
|
||||
UPDATE `config` SET `ord`='2600' WHERE `var`='participant_student_pronunciation';
|
||||
UPDATE `config` SET `ord`='1700' WHERE `var`='participant_mentor';
|
||||
UPDATE `config` SET `ord`='1800',`type`='number' WHERE `var`='participant_project_summary_wordmax';
|
||||
UPDATE `config` SET `ord`='1900',`type`='number' WHERE `var`='participant_project_summary_wordmin';
|
||||
UPDATE `config` SET `ord`='2000',`type`='number' WHERE `var`='participant_project_title_charmax';
|
||||
UPDATE `config` SET `ord`='2300' WHERE `var`='participant_project_table';
|
||||
UPDATE `config` SET `ord`='2400' WHERE `var`='participant_project_electricity';
|
||||
UPDATE `config` SET `ord`='2500' WHERE `var`='participant_student_foodreq';
|
||||
UPDATE `config` SET `ord`='2600' WHERE `var`='participant_student_tshirt';
|
||||
UPDATE `config` SET `ord`='2700' WHERE `var`='participant_student_tshirt_cost';
|
||||
UPDATE `config` SET `ord`='2800' WHERE `var`='specialawardnomination_aftersignatures';
|
||||
UPDATE `config` SET `ord`='2900' WHERE `var`='specialawardnomination';
|
||||
UPDATE `config` SET `ord`='3000' WHERE `var`='usedivisionselector';
|
||||
|
||||
INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year`) VALUES (
|
||||
'participant_short_title_charmax', '50', 'Participant Registration', 'number', '', '2200', 'The maximum number of characters acceptable in the short project title (Max 255)', '-1');
|
||||
INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year`) VALUES (
|
||||
'participant_short_title_enable', 'no', 'Participant Registration', 'yesno', '', '2100', 'Ask the participants for a short project title as well as their full title.', '-1');
|
@ -122,6 +122,9 @@ function projectStatus($reg_id="")
|
||||
global $config;
|
||||
$required_fields=array("title","projectcategories_id","projectdivisions_id","summary","language","req_table","req_electricity","summarycountok");
|
||||
|
||||
if($config['participant_short_title_enable'] == 'yes')
|
||||
$required_fields[] = 'shorttitle';
|
||||
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
|
||||
|
@ -100,8 +100,19 @@ echo mysql_error();
|
||||
else
|
||||
$title=stripslashes($_POST['title']);
|
||||
|
||||
if($config['participant_short_title_enable'] == 'yes'
|
||||
&& $config['participant_short_title_charmax']
|
||||
&& strlen(stripslashes($_POST['shorttitle']))>$config['participant_short_title_charmax']) //0 for no limit, eg 255 database field limit
|
||||
{
|
||||
$shorttitle=substr(stripslashes($_POST['shorttitle']),0,$config['participant_short_title_charmax']);
|
||||
echo error(i18n("Short project title truncated to %1 characters",array($config['participant_short_title_charmax'])));
|
||||
}
|
||||
else
|
||||
$shorttitle=stripslashes($_POST['shorttitle']);
|
||||
|
||||
mysql_query("UPDATE projects SET ".
|
||||
"title='".mysql_escape_string($title)."', ".
|
||||
"shorttitle='".mysql_escape_string($shorttitle)."', ".
|
||||
"projectdivisions_id='".$_POST['projectdivisions_id']."', ".
|
||||
"language='".mysql_escape_string(stripslashes($_POST['language']))."', ".
|
||||
"req_table='".mysql_escape_string(stripslashes($_POST['req_table']))."', ".
|
||||
@ -194,6 +205,7 @@ function countwords()
|
||||
</script>
|
||||
<?
|
||||
|
||||
|
||||
echo "<form name=\"projectform\" method=\"post\" action=\"register_participants_project.php\">\n";
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
||||
echo "<input type=\"hidden\" name=\"id\" value=\"$projectinfo->id\">\n";
|
||||
@ -202,6 +214,12 @@ function countwords()
|
||||
if($config['participant_project_title_charmax'])
|
||||
echo i18n("(Max %1 characters)",array($config['participant_project_title_charmax']));
|
||||
echo "</td></tr>\n";
|
||||
if($config['participant_short_title_enable'] == 'yes') {
|
||||
echo "<tr><td>".i18n("Short Project Title").": </td><td><input type=\"text\" name=\"shorttitle\" size=\"50\" value=\"".htmlspecialchars($projectinfo->shorttitle)."\" />".REQUIREDFIELD;
|
||||
if($config['participant_short_title_charmax'])
|
||||
echo i18n("(Max %1 characters)",array($config['participant_short_title_charmax']));
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
echo "<tr><td>".i18n("Age Category").": </td><td>";
|
||||
echo i18n($agecategories[$projectcategories_id]['category']);
|
||||
echo " (".i18n("Grades %1-%2",array($agecategories[$projectcategories_id]['mingrade'],$agecategories[$projectcategories_id]['maxgrade'])).")";
|
||||
|
Loading…
x
Reference in New Issue
Block a user