Add a title field and default it to the event name (lets them do things like "Compound Boggle #1" and "Compound Boggle #2"

Add max team capacity editor and numbers to display
This commit is contained in:
james 2010-06-14 20:37:31 +00:00
parent 76652861d4
commit 1fa7139482
5 changed files with 68 additions and 13 deletions

View File

@ -92,7 +92,7 @@
echo "<div class=\"scheduleevent scheduleevent_{$r->eventtype}\" id=\"event_{$r->id}\" onclick=\"editEvent($r->id)\">";
echo "<div style=\"width: 99%; text-align: right;\"><a href=\"#\" onclick=\"return deleteEvent(event,$r->id)\"><img style=\"border: 0px;\" src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.{$config['icon_extension']}\"></a></div>\n";
echo "<span class=\"scheduleevent_title\">";
echo $r->name;
echo $r->title;
echo "</span>";
echo "<br />";
$starttime=strtotime($r->hour.":".$r->minute);
@ -101,6 +101,17 @@
echo " to ";
echo format_time($endtime);
if($r->eventtype=="scienceolympic") {
echo "<br />";
echo i18n("Teams")." : ";
//FIXME: get # actually registered
$regteams=0;
$maxteams=$r->somaxteams;
echo i18n("%1 of %2",array($regteams,$maxteams));
}
echo "</div>";
$js.="eventdivs[$r->id]={hour:$r->hour,minute:$r->minute,location:$r->locations_id,duration:$r->duration};\n";
$x++;
@ -130,12 +141,14 @@
list($event_id,$event_type)=explode(":",$_POST['event_id']);
if($event_id>0) {
mysql_query("UPDATE schedule SET
title='".mysql_real_escape_string($_POST['title'])."',
date='".mysql_real_escape_string($_POST['date'])."',
hour='".mysql_real_escape_string($_POST['hour'])."',
minute='".mysql_real_escape_string($_POST['minute'])."',
duration='".mysql_real_escape_string($_POST['duration'])."',
events_id='$event_id',
locations_id='".mysql_real_escape_string($_POST['location_id'])."'
locations_id='".mysql_real_escape_string($_POST['location_id'])."',
somaxteams='".mysql_real_escape_string($_POST['somaxteams'])."'
WHERE id='$id' AND conferences_id='{$conference['id']}'");
echo mysql_error();
happy_("Event successfully saved");
@ -229,6 +242,7 @@
$.getJSON("schedule.php?action=loadevent&id="+id,function(json) {
//general tab
$("#edit_schedule_id").val(json.id);
$("#edit_title").val(json.title);
$("#edit_date").val(json.date);
$("#edit_hour").val(json.hour);
$("#edit_minute").val(json.minute);
@ -246,6 +260,7 @@
$("#event_editor_dialog").dialog('option','title','Create Event');
var a=cell.split("_");
$("#edit_schedule_id").val(0);
$("#edit_title").val("");
$("#edit_date").val($("#date").val());
$("#edit_hour").val(a[0]);
$("#edit_minute").val(a[1]);
@ -253,6 +268,12 @@
$("#edit_location").val(a[2]);
$("#edit_event").val("");
//science olympics tab
$("#edit_somaxteams").val("");
$("#schedule_tabs").tabs('select',0);
event_change();
}
$("#event_editor_dialog").dialog('option','width',600);
$("#event_editor_dialog").dialog('option','height',400);

View File

@ -13,7 +13,6 @@ $(document).ready(function() {
},
selected: 0
});
event_change();
});
@ -41,6 +40,18 @@ function event_change() {
break;
}
if($("#edit_title").val().length) {
//umm if it already exists, dont change it
if($("#edit_title").val=="Choose") {
$("#edit_title").val($("#edit_event option:selected").text());
}
}
else
{
if($("#edit_event").val())
$("#edit_title").val($("#edit_event option:selected").text());
}
}
</script>
@ -51,13 +62,13 @@ function event_change() {
<li><a href="#schedule_tab_sciencefairjudging"><span><?=i18n('Science Fair Judging')?></span></a></li>
<li><a href="#schedule_tab_tour"><span><?=i18n('Tour')?></span></a></li>
</ul>
<form method="post" id="edit_event_form">
<div id="schedule_tab_general">
<?
echo "<form method=\"post\" id=\"edit_event_form\">";
echo "<input type=\"hidden\" name=\"id\" id=\"edit_schedule_id\">";
echo "<table style=\"width: 95%;\">";
echo "<tr><td>";
@ -84,12 +95,12 @@ echo "</td></tr>\n";
echo "<tr><td>";
echo i18n("Start at").": ";
echo i18n("Title").": ";
echo "</td><td>";
emit_hour_selector('hour',"","id=\"edit_hour\"");
echo ":";
emit_minute_selector('minute',"","id=\"edit_minute\"",15);
echo "<input id=\"edit_title\" type=\"text\" name=\"title\" size=\"20\">";
echo "</td><td>";
echo i18n("Date").": ";
echo "</td><td>";
echo "<input id=\"edit_date\" type=\"text\" name=\"date\" class=\"date\" size=\"12\">";
@ -98,6 +109,16 @@ echo "</td><td>";
echo "</td></tr>\n";
echo "<tr><td>";
echo i18n("Start at").": ";
echo "</td><td>";
emit_hour_selector('hour',"","id=\"edit_hour\"");
echo ":";
emit_minute_selector('minute',"","id=\"edit_minute\"",15);
echo "</td><td>";
echo i18n("Duration").": ";
echo "</td><td>";
echo "<input id=\"edit_duration\" type=\"text\" name=\"duration\" size=\"4\">";
@ -105,19 +126,20 @@ echo "minutes";
echo "</td></tr>\n";
echo "</table>";
echo "</form>\n";
?>
</div>
<div id="schedule_tab_scienceolympics">
<?
echo "<table style=\"width: 95%;\">";
echo "<table>";
echo "<tr><td>";
echo i18n("Maximum Number of Teams").": ";
echo "</td><td>";
echo "<input type=\"text\" name=\"somaxteams\" id=\"edit_somaxteams\" size=\"4\">";
echo "</td></tr>";
echo "</table>";
echo "FIXME: the fields below this line are not functional yet";
echo "<hr />";
echo "<table style=\"width: 95%;\">";
echo "<tr>";
@ -137,6 +159,15 @@ for($x=7;$x<=12;$x++) {
echo "<input type=\"checkbox\" name=\"recommendedgrades[]\"> Grade $x <br />\n";
}
echo "</td></tr>\n";
echo "<tr>";
echo "<td>";
echo i18n("Judges").": ";
echo "</td><td>";
echo "show list of registered judges to choose from";
echo "</td></tr>";
echo "</table>";
@ -145,5 +176,7 @@ echo "</table>";
<div id="schedule_tab_sciencefairjudging">
</div>
<div id="schedule_tab_tour">
</div>
</form>
</div>

View File

@ -1 +1 @@
182
183

1
db/db.update.183.sql Normal file
View File

@ -0,0 +1 @@
ALTER TABLE `schedule` ADD `title` VARCHAR( 128 ) NOT NULL AFTER `date`;

View File

@ -533,14 +533,14 @@ ul.conferencenav li a:hover {
z-index: 1000;
display: none;
overflow: auto;
font-size: 0.9em;
font-size: 0.8em;
text-align: center;
cursor: pointer;
}
.scheduleevent_title {
font-weight: bold;
font-size: 1.2em;
font-size: 1.1em;
}
.scheduleevent_general {