- Use the report generator dialog all the time

This commit is contained in:
dave 2009-11-06 08:24:54 +00:00
parent 3bead26bf8
commit ba808050d0
3 changed files with 34 additions and 34 deletions

View File

@ -175,8 +175,12 @@ function save_report()
function add_report()
{
var reports_id = $('#report').val();
edit_report(-1, reports_id);
edit_report(-1, $('#report').val());
}
function gen_report()
{
report_gen($('#report').val());
}
var edit=false;
@ -255,14 +259,12 @@ $(document).ready(function() {
}
if($i->reports_id > 0) {
$name = $i->name;
$url = "admin/reports_gen.php?id={$i->reports_id}&show_options=1";
// $url = "admin/reports_gen.php?id={$i->reports_id}&show_options=1";
$name = "<a href=\"#\" onclick=\"report_gen({$i->reports_id}); return false\">{$i->name}</a>";
} else {
$name = $report_custom[-$i->reports_id]['name'];
$url = $report_custom[-$i->reports_id]['custom_url'];
$name = "<a href=\"{$config['SFIABDIRECTORY']}/{$report_custom[-$i->reports_id]['custom_url']}\">
{$report_custom[-$i->reports_id]['name']}</a>";
}
$name = "<a href=\"{$config['SFIABDIRECTORY']}/$url\">$name</a>";
?>
<tr id="report_tr_<?=$i->id?>">
<td style="border:0px;"><?=$name?></td>
@ -315,8 +317,7 @@ $(document).ready(function() {
<hr />
<h4><?=i18n("All Reports")?></h3>
<form method="get" name="reportgen" action="reports_gen.php">
<input type="hidden" name="show_options" value="1" />
<form name="reportgen" >
<select name="id" id="report">
<option value="0"><?=i18n("Select a Report")?></option>
<?
@ -325,7 +326,7 @@ foreach($reports as $r) {
}
?>
</select><br />
<input type="submit" value="<?=i18n("Generate Report")?>">
<input type="submit" onclick="gen_report();return false;" value="<?=i18n("Generate Report")?>">
<input type="submit" onclick="add_report();return false;" value="<?=i18n("Add this Report to my list")?>">
</form>
<br />

View File

@ -121,38 +121,31 @@ case 'dialog_gen':
echo "</select></td></tr>";
?>
</table>
<br />
<hr />
<div align="right">
<input type="submit" id="report_dialog_gen_pdf_button" value="<?=i18n('Download PDF')?>" />
<input type="submit" id="report_dialog_gen_cancel_button" value="<?=i18n('Cancel')?>" />
</form>
</div>
<script type="text/javascript">
$("#report_dialog_gen_pdf_button").click(function () {
var dlargs = $('#report_dialog_form').serialize()+"<?=$filter_args?>";
var dlurl = "<?=$config['SFIABDIRECTORY']?>/admin/reports_gen.php?"+dlargs;
// alert(dlurl);
// $('#content').attr('src',dlurl);
window.location.href=dlurl;
$('#report_dialog_gen').dialog("close");
return false;
});
$("#report_dialog_gen_cancel_button").click(function () {
$('#report_dialog_gen').dialog("close");
return false;
});
$("#report_dialog_gen").dialog({
bgiframe: true, autoOpen: true,
modal: true, resizable: false,
draggable: false,
width: 800, //(document.documentElement.clientWidth * 0.8);
height: (document.documentElement.clientHeight * 0.5),
height: 600, //(document.documentElement.clientHeight * 0.7),
close: function() {
$(this).dialog('destroy');
$('#report_dialog_gen').remove();
}
},
buttons: { "<?=i18n("Cancel")?>": function() {
$('#report_dialog_gen').dialog("close");
return false;
},
"<?=i18n("Download PDF")?>": function() {
var dlargs = $('#report_dialog_form').serialize()+"<?=$filter_args?>";
var dlurl = "<?=$config['SFIABDIRECTORY']?>/admin/reports_gen.php?"+dlargs;
// alert(dlurl);
// $('#content').attr('src',dlurl);
window.location.href=dlurl;
$('#report_dialog_gen').dialog("close");
return false;
},
},
});
</script>

View File

@ -62,6 +62,12 @@ function notice_(str)
notice_create('notice',str,-1);
}
function report_gen(id)
{
var args="id="+id+"&action=dialog_gen";
$("#debug").load("reports_gen.php?"+args);
}
/* Stuff to do after the document loads */
$(document).ready(function()
{