diff --git a/admin/reports_students.inc.php b/admin/reports_students.inc.php index 812c2060..6c65c957 100644 --- a/admin/reports_students.inc.php +++ b/admin/reports_students.inc.php @@ -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', diff --git a/db/db.code.version.txt b/db/db.code.version.txt index f906e184..c17e934b 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -96 +97 diff --git a/db/db.update.97.sql b/db/db.update.97.sql new file mode 100644 index 00000000..c102ad21 --- /dev/null +++ b/db/db.update.97.sql @@ -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'); diff --git a/register_participants.inc.php b/register_participants.inc.php index e6fae17f..14b65267 100644 --- a/register_participants.inc.php +++ b/register_participants.inc.php @@ -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']; diff --git a/register_participants_project.php b/register_participants_project.php index 5601356d..3e6f73f7 100644 --- a/register_participants_project.php +++ b/register_participants_project.php @@ -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() \n"; echo "\n"; echo "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 "\n"; + if($config['participant_short_title_enable'] == 'yes') { + echo "".i18n("Short Project Title").": shorttitle)."\" />".REQUIREDFIELD; + if($config['participant_short_title_charmax']) + echo i18n("(Max %1 characters)",array($config['participant_short_title_charmax'])); + echo "\n"; + } echo "".i18n("Age Category").": "; echo i18n($agecategories[$projectcategories_id]['category']); echo " (".i18n("Grades %1-%2",array($agecategories[$projectcategories_id]['mingrade'],$agecategories[$projectcategories_id]['maxgrade'])).")";