From 9bd50a5e5a5be8b7786b600057b3a0b1f993e228 Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 10 Dec 2007 09:14:48 +0000 Subject: [PATCH] - 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. --- admin/committee_reports.php | 61 ++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/admin/committee_reports.php b/admin/committee_reports.php index 0fa2afc..958f9c3 100644 --- a/admin/committee_reports.php +++ b/admin/committee_reports.php @@ -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 ''; $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 '

'; @@ -135,25 +143,27 @@ if($edit_mode == false) $name = "$name"; - echo "

"; - echo "
$name
"; - if($edit_mode == true) { - echo "id}\">\"Remove"; - } + echo ""; - echo ""; + echo "
"; - echo ""; + echo "'; + +/* if($i->reports_id > 0) { + echo ''; } - echo ""; +*/ - echo ""; - echo "
"; + if($edit_mode == true) + echo "id}\">\"Remove "; + echo $name.'
'; + echo ''; 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 ''; + echo '
{$i->comment}
"; + echo "
{$i->comment}
"; } } @@ -187,23 +197,36 @@ echo '
'; + ?> + + '.i18n('Add a Report to your Report List').''; - echo "
"; + echo ""; echo ""; echo "\n"; echo '"; + /* 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 ""; echo "";
'; - echo ""; $x=0; foreach($reports as $r) { $x++; - echo ""; + $sel = ($reports_id == $r['id']) ? 'selected="selected"' : ''; + echo ""; + } $rid = -1; foreach($report_custom as $r) { $x++; - echo ""; + $sel = ($reports_id == $rid) ? 'selected="selected"' : ''; + echo ""; $rid--; } @@ -223,13 +246,15 @@ echo "OR New Category: "; echo "
{$o['desc']}: