- Add a #content iframe to the toplevel, hidden, width,hight=0,0

- Add a report generator dialog box that uses the content iframe for file downloads
- The content iframe also works for creating dynamic content
- Try to make FCKEditor work with jquery, it still doesn't.  The content of FCKEditor isn't passed
  through serializeArray it seems.
This commit is contained in:
dave 2009-10-15 07:11:43 +00:00
parent 2eea87c350
commit cf5c31464e
4 changed files with 135 additions and 18 deletions

View File

@ -227,17 +227,10 @@ case 'dialog_edit':
<td class="input"><input type="text" name="from" size="60" value="<?=$from?>" /></td>
</tr><tr>
<td colspan="2" class="input">
<table width="100%"><tr><td width="85%"><?
require_once("../fckeditor/fckeditor.php");
$oFCKeditor = new FCKeditor("bodyhtml") ;
$oFCKeditor->BasePath = "../fckeditor/";
$oFCKeditor->ToolbarSet = 'sfiab';
$oFCKeditor->Value = $bodyhtml;
$oFCKeditor->Width="100%";
$oFCKeditor->Height=300;
$oFCKeditor->Create();
// echo "<textarea name=\"bodyhtml\" rows=6 cols=80>=$bodyhtml</textarea>"
?>
<table width="100%"><tr><td width="85%">
<div id="fck">
<textarea id="bodyhtml" name="bodyhtml" rows=6 cols=80><?=$bodyhtml?>hi</textarea>
</div>
</td><td width="15%">
<select name="insert_field" size="20" style="height:300" >
<option value="FAIRNAME">[EMAIL]</option>
@ -256,6 +249,7 @@ case 'dialog_edit':
</div>
</form>
</div>
<script type="text/javascript" src="<?=$config['SFIABDIRECTORY']?>/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
var comm_dialog_edit_saved = false;
$("#comm_dialog_edit_save_button").click(function () {
@ -295,7 +289,13 @@ case 'dialog_edit':
}
});
var oFCKeditor = new FCKeditor( 'bodyhtml' ) ;
oFCKeditor.BasePath = "../fckeditor/" ;
oFCKeditor.ToolbarSet = 'sfiab';
oFCKeditor.Width="100%";
oFCKeditor.Height=300;
$('#fck').html(oFCKeditor.CreateHtml());
// oFCKeditor.ReplaceTextarea() ;
</script>
<?

View File

@ -429,7 +429,7 @@ switch($_GET['action']){
}
echo "</td>\n";
echo "<td style=\"text-align: center;\"><input type=\"button\" onclick=\"return opensendmaildialog()\" value=\"".i18n("General PDF for mailing")."\" /></td>\n";
echo "<td style=\"text-align: center;\"><input type=\"button\" onclick=\"return opensendlabelsdialog()\" value=\"".i18n("Generate mailing labels")."\" /></td>\n";
echo "<td style=\"text-align: center;\"><input type=\"button\" onclick=\"return opensendlabelsdialog(6)\" value=\"".i18n("Generate mailing labels")."\" /></td>\n";
echo "</tr></table>\n";
echo "</td></tr>\n";
echo "</table>\n";
@ -664,12 +664,12 @@ function prospect_removeall() {
//key is initial or followup
//start is either 'new' to start with a blank, or 'existing' to load an existing email to start from
function opencommunicationeditor(key,id,fcid) {
$("#dialog").empty();
$("#content").empty();
if(id) {
$("#dialog").load("communication.php?action=dialog_edit&id="+id+"&fundraising_campaigns_id="+fcid,null,function() {
$("#content").load("communication.php?action=dialog_edit&id="+id+"&fundraising_campaigns_id="+fcid,null,function() {
});
} else {
$("#dialog").load("communication.php?action=dialog_edit&key="+key+"&fundraising_campaigns_id="+fcid,null,function() {
$("#content").load("communication.php?action=dialog_edit&key="+key+"&fundraising_campaigns_id="+fcid,null,function() {
});
}
}
@ -711,6 +711,13 @@ function comm_dialog_edit_cancel() {
// alert("cancelled!");
}
function opensendlabelsdialog(reports_id) {
$("#dialog").empty();
$("#dialog").load("reports_gen.php?action=dialog_gen&id="+reports_id,null,function() {
});
}
</script>
<?

View File

@ -27,8 +27,8 @@
user_auth_required('committee', 'admin');
require_once('reports.inc.php');
$id = intval($_GET['id']);
$sid = intval($_GET['sid']);
$type = stripslashes($_GET['type']);
$stock = stripslashes($_GET['stock']);
$year = intval($_GET['year']);
@ -36,11 +36,119 @@
if($year < 1000) $year = $config['FAIRYEAR'];
/* If it's a system report, turn that into the actual report id */
if($sid > 0) {
if(array_key_exists('sid', $_GET)) {
$sid = intval($_GET['sid']);
$q = mysql_query("SELECT id FROM reports WHERE system_report_id='$sid'");
$r = mysql_fetch_assoc($q);
$id = $r['id'];
}
switch($_GET['action']) {
case 'dialog_gen':
$report = report_load($id);
?>
<div id="report_dialog_gen" title="Generate Report" style="display: none">
<form id="report_dialog_form" >
<input type="hidden" name="id" value="<?=$id?>" />
<table class="editor" style="width:95%"><tr>
<td colspan="2"><br /><h3><?=i18n('Report Information')?></h3><br /></td>
</tr><tr>
<td class="label"><b><?=i18n("Report Name")?></b>:</td>
<td class="input"><?=$report['name']?></b></td>
</tr><tr>
<td class="label"><b><?=i18n("Description")?></b>:</td>
<td class="input"><?=$report['desc']?></b></td>
</tr><tr>
<td class="label"><b><?=i18n("Created By")?></b>:</td>
<td class="input"><?=$report['creator']?></td>
</tr><tr>
<?
/* See if the report is in this committee member's list */
$q = mysql_query("SELECT * FROM reports_committee
WHERE users_id='{$_SESSION['users_uid']}'
AND reports_id='{$report['id']}'");
if(mysql_num_rows($q) > 0) {
$i = mysql_fetch_assoc($q);
?>
<td colspan="2"><hr /><h3><?=i18n('My Reports Info')?></h3></td>
</tr><tr>
<td class="label"><b><?=i18n("Category")?></b>:</td>
<td class="input"><?=$i['category']?></b></td>
</tr><tr>
<td class="label"><b><?=i18n("Comment")?></b>:</td>
<td class="input"><?=$i['comment']?></b></td>
</tr><tr>
<? } ?>
<td colspan="2"><br /><hr /><h3><?=i18n('Report Options')?></h3><br /></td>
</tr>
<?
$format = $report['options']['type'];
$stock = $report['options']['stock'];
$year = $config['FAIRYEAR'];
/* Out of all the report optins, we really only want these ones */
$option_keys = array('type','stock');
foreach($report_options as $ok=>$o) {
if(!in_array($ok, $option_keys)) continue;
echo "<tr><td class=\"label\"><b>{$o['desc']}</b>:</td>";
echo "<td class=\"input\"><select name=\"$ok\" id=\"$ok\">";
foreach($o['values'] as $k=>$v) {
$sel = ($report['option'][$ok] == $k) ? 'selected=\"selected\"' : '';
echo "<option value=\"$k\" $sel>$v</option>";
}
echo "</select></td></tr>";
}
/* Find all the years */
$q = mysql_query("SELECT DISTINCT year FROM config WHERE year>1000 ORDER BY year DESC");
echo "<tr><td class=\"label\"><b>".i18n('Year')."</b>:</td>";
echo "<td class=\"input\"><select name=\"year\" id=\"year\">";
while($i = mysql_fetch_assoc($q)) {
$y = $i['year'];
$sel = ($config['FAIRYEAR'] == $y) ? 'selected=\"selected\"' : '';
echo "<option value=\"$y\" $sel>$y</option>";
}
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();
var dlurl = "<?=$config['SFIABDIRECTORY']?>/admin/reports_gen.php?"+dlargs;
$('#content').attr('src',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),
close: function() {
$(this).dialog('destroy');
$('#report_dialog_gen').remove();
}
});
</script>
<?
exit;
}
if($show_options == false) {
if($id && $year) {

View File

@ -625,6 +625,7 @@ echo "<a target=\"blank\" href=\"http://www.sfiab.ca\">SFIAB Version ".$config['
?>
</div>
<div id="debug" style="display:<?=($_SESSION['debug']=='true')?'block':'none'?>">Debug...</div>
<iframe id="content" src="" style="visibility:hidden; width:0px; height:0px"></iframe>
</body>
</html>
@ -680,6 +681,7 @@ echo "SFIAB Version ".$config['version'];
?>
</div>
<div id="debug" style="display:<?=($_SESSION['debug']=='true')?'block':'none'?>">Debug...</div>
<iframe id="content" src="" style="visibility:hidden; width:0px; height:0px"></iframe>
</body>
</html>