forked from science-ation/science-ation
- Do a reload on report selection when adding a report. FIXME: I need to find
a way to make this page not jump back to the top after the reload.
This commit is contained in:
parent
1e6ffcfa7f
commit
9bd50a5e5a
@ -45,6 +45,12 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
$reports_id = 0;
|
||||
if($action == 'reload') {
|
||||
$edit_mode = true;
|
||||
$reports_id = intval($_POST['reports_id']);
|
||||
}
|
||||
|
||||
if($action == 'add') {
|
||||
$reports_id = intval($_POST['reports_id']);
|
||||
/* reports_id might be < 0, that's ok */
|
||||
@ -114,8 +120,10 @@
|
||||
|
||||
echo '<table>';
|
||||
$last_category = '';
|
||||
|
||||
$x=0;
|
||||
while($i = mysql_fetch_object($q)) {
|
||||
$trclass = ($x % 2 == 0) ? "even" : "odd";
|
||||
$x++;
|
||||
if($last_category != $i->category) {
|
||||
/* New category */
|
||||
echo '<h4>';
|
||||
@ -135,25 +143,27 @@
|
||||
if($edit_mode == false)
|
||||
$name = "<a href=\"{$config['SFIABDIRECTORY']}/$url\">$name</a>";
|
||||
|
||||
echo "<table><tr><td colspan=\"2\">$name</td></tr>";
|
||||
echo "<tr><td width=\"20px\">";
|
||||
if($edit_mode == true) {
|
||||
echo "<a title=\"Remove Report\" href=\"committee_reports.php?action=unlink&id={$i->id}\"><img src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\" border=\"0\" alt=\"Remove Report\" /></a>";
|
||||
}
|
||||
echo "<table width=\"100%\"><tr class=\"$trclass\"><td>";
|
||||
|
||||
echo "</td>";
|
||||
echo "<td><span style=\"font-size: 0.75em;\">";
|
||||
echo "<table><tr><td colspan=\"2\">";
|
||||
if($edit_mode == true)
|
||||
echo "<a title=\"Remove Report\" href=\"committee_reports.php?action=unlink&id={$i->id}\"><img src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\" border=\"0\" alt=\"Remove Report\" /></a> ";
|
||||
echo $name.'</td></tr>';
|
||||
|
||||
/*
|
||||
if($i->reports_id > 0) {
|
||||
echo '<tr><td width=\"20px\"></td><td>';
|
||||
echo '<span style=\"font-size: 0.75em;\">';
|
||||
echo i18n('Format').": {$i->format}, ";
|
||||
echo i18n('Paper').": {$report_stock[$i->stock]['name']}, ";
|
||||
echo i18n('Year').": {$config['FAIRYEAR']}";
|
||||
} else {
|
||||
echo i18n('Custom report, no options available');
|
||||
echo '</span>';
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo "</span></td></tr>";
|
||||
*/
|
||||
|
||||
echo "<tr><td></td><td>{$i->comment}</td></tr>";
|
||||
echo "</table>";
|
||||
echo "<tr><td width=\"20px\"></td><td><span style=\"font-size: 0.85em;\">{$i->comment}</span></td></tr>";
|
||||
echo "</table></tr></td></table>";
|
||||
}
|
||||
|
||||
}
|
||||
@ -187,23 +197,36 @@
|
||||
|
||||
echo '<hr />';
|
||||
|
||||
?>
|
||||
<SCRIPT language="JavaScript">
|
||||
function add_reload()
|
||||
{
|
||||
document.addreport.action.value='reload';
|
||||
document.addreport.submit();
|
||||
return true;
|
||||
}
|
||||
</SCRIPT>
|
||||
<?
|
||||
|
||||
/* Create an add report box */
|
||||
echo '<h4>'.i18n('Add a Report to your Report List').'</h4>';
|
||||
echo "<form method=\"post\" action=\"committee_reports.php\">";
|
||||
echo "<form method=\"post\" name=\"addreport\"action=\"committee_reports.php\">";
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"add\">";
|
||||
echo "<table>\n";
|
||||
echo '<tr><td colspan="2">';
|
||||
echo "<select name=\"reports_id\">";
|
||||
echo "<select name=\"reports_id\" onChange=\"add_reload()\">";
|
||||
$x=0;
|
||||
foreach($reports as $r) {
|
||||
$x++;
|
||||
echo "<option value=\"{$r['id']}\">$x. {$r['name']}</option>";
|
||||
$sel = ($reports_id == $r['id']) ? 'selected="selected"' : '';
|
||||
echo "<option value=\"{$r['id']}\" $sel>$x. {$r['name']}</option>";
|
||||
|
||||
}
|
||||
$rid = -1;
|
||||
foreach($report_custom as $r) {
|
||||
$x++;
|
||||
echo "<option value=\"$rid\">$x. {$r['name']}</option>";
|
||||
$sel = ($reports_id == $rid) ? 'selected="selected"' : '';
|
||||
echo "<option value=\"$rid\" $sel>$x. {$r['name']}</option>";
|
||||
$rid--;
|
||||
}
|
||||
|
||||
@ -223,13 +246,15 @@
|
||||
echo "OR New Category: <input type=\"text\" name=\"category\">";
|
||||
echo "</td></tr>";
|
||||
|
||||
/* Load the full specific report */
|
||||
if($reports_id > 0) $report = report_load($reports_id);
|
||||
$option_keys = array('type','stock');
|
||||
foreach($report_options as $ok=>$o) {
|
||||
if(!in_array($ok, $option_keys)) continue;
|
||||
echo "<tr><td>{$o['desc']}:</td>";
|
||||
echo "<td><select name=\"$ok\" id=\"$ok\">";
|
||||
foreach($o['values'] as $k=>$v) {
|
||||
$sel = ($r['option'][$ok] == $k) ? 'selected=\"selected\"' : '';
|
||||
$sel = ($report['option'][$ok] == $k) ? 'selected=\"selected\"' : '';
|
||||
echo "<option value=\"$k\" $sel>$v</option>";
|
||||
}
|
||||
echo "</select></td></tr>";
|
||||
|
Loading…
Reference in New Issue
Block a user