| Current Path : /var/www/cesa.co.za/Mailer/ |
| Current File : /var/www/cesa.co.za/Mailer/orderSections_old.php |
<?php
require_once ('includes/globals.php');
$nl_id = intval($_GET['id']);
if (isset($_SESSION['userid'])) {
$userid = $_SESSION['userid'];
} else {
echo "<script>document.location.href='index.php';</script>\n";
}
if (isset($_SESSION['database'])) {
$sql1 = "SELECT idUser, sTitle, sHeading, dtCreated, dtSent, idPreviousIssue FROM Newsletter\n".
"where idNewsletter = " . $nl_id;
$rsN = $db->Execute($sql1);
$sql2 = "SELECT idSection, sTitle, txtDetail FROM Sections\n".
"where idNewsletter = " . $nl_id . "\n".
"order by nOrder";
$rsS = $db->Execute($sql2);
if ($rsS->rowcount() > 0) {
?>
<?php /*
<%@page import="co.za.vivid.saace.mail.builder.*,java.util.Vector"%>
<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
if (session.getAttribute("UserID") != null) {
Newsletter newsletter = new Newsletter();
newsletter.populateById(Integer.parseInt(request.getParameter("id")));
Section sec = new Section();
Vector collection = sec.getSectionsByParentId(newsletter.getId());
if (!collection.isEmpty()) {
%>
*/?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Email template control panel</title>
<link rel="stylesheet" type="text/css" href="stylesheet/default_styles.css">
<style type="text/css">
.bg0 {
background-color : #016694;
color:#FFFFFF;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;
}
.bg1 {
background-color : #6DD1FF;
color:#000000;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;
}
</style>
<script language="JavaScript1.2" type="text/javascript">
function moveUp(y) {
if (true) {
var tempID = eval("document.theForm.id" + y + ".value");
var tempName = eval("document.getElementById('name" + y + "').innerHTML");
bobId = eval("document.theForm.id" + y);
bobId.value = eval("document.theForm.id" + (y-1) + ".value");
bobName = eval("document.getElementById('name" + y + "')");
bobName.innerHTML = eval("document.getElementById('name" + (y-1) + "').innerHTML");
bobId = eval("document.theForm.id" + (y-1));
bobId.value = tempID;
bobName = eval("document.getElementById('name" + (y-1) + "')");
bobName.innerHTML = tempName;
}
}
function moveDown(y) {
var tempID = eval("document.theForm.id" + y + ".value");
var tempName = eval("document.getElementById('name" + y + "').innerHTML");
bobId = eval("document.theForm.id" + y);
bobId.value = eval("document.theForm.id" + (y+1) + ".value");
bobName = eval("document.getElementById('name" + y + "')");
bobName.innerHTML = eval("document.getElementById('name" + (y+1) + "').innerHTML");
bobId = eval("document.theForm.id" + (y+1));
bobId.value = tempID;
bobName = eval("document.getElementById('name" + (y+1) + "')");
bobName.innerHTML = tempName;
}
</script>
</head>
<body bgcolor="#D0ECF8" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td height="110" bgcolor="#016694"><img src="images/spacer.gif" width="1" height="110"></td>
</tr>
<tr>
<td height="2" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="2"></td>
</tr>
<tr>
<td height="2" bgcolor="#016694"><img src="images/spacer.gif" width="1" height="2"></td>
</tr>
<tr>
<td height="30"><img src="images/spacer.gif" width="1" height="30"></td>
</tr>
<tr>
<td class="paddingLeft20">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr>
<td height="10"></td>
</tr>
<tr>
<td class="blackType"><strong>Order sections</strong> - <?php echo $rsN->fields[1]; ?><br></td>
</tr>
<tr>
<td><hr></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td valign="top">
<table border="0" cellspacing="0" cellpadding="6">
<form name="theForm" id="theForm" method="post" action="sectionUpdate.php">
<input type="Hidden" name="numberOut" id="numberOut" value="<?php echo $rsS->rowcount(); ?>">
<input type="Hidden" name="parent" id="parent" value="<?php echo $nl_id; ?>">
<?php
/*
int i = 1;
for(int dirCounter=0;dirCounter<collection.size();dirCounter++) {
sec = (Section) collection.elementAt(dirCounter);
*/
$i = 1;
while (! $rsS->EOF) {
?>
<tr class="bg<?php echo $i % 2; ?>">
<td bgcolor="#D0ECF8"><input type="Hidden" id="id<?php echo $i; ?>" name="id<?php echo $i; ?>" value="<?php echo $rsS->fields[0]; ?>"></td>
<td bgcolor="#D0ECF8" width="20"></td>
<td id="name<?php echo $i; ?>" name="name<?php echo $i; ?>"><?php echo $rsS->fields[1]; ?></td>
<td style="cursor:hand" onClick="moveUp(<?php echo $i; ?>)"><FONT FACE="Symbol">Ý</FONT></td>
<td style="cursor:hand" onClick="moveDown(<?php echo $i; ?>)"><FONT FACE="Symbol">ß</FONT></td>
</tr>
<?php
$i++;
$rsS->MoveNext();
}
?>
</form>
</table>
</td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td><hr></td>
</tr>
<tr>
<td valign="top" align="middle">
<table border="0" cellpadding="0" cellspacing="5">
<tr>
<td><input type="button" value="Back" class="button" onClick="javascript:document.location='manageSections.php?id=<?php echo $nl_id; ?>';"></td>
<td width="20"></td>
<td><input type="button" value="Apply" class="button" onClick="javascript:document.theForm.submit();"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="blackType">
<strong>Ordering sections</strong><br>
<br>
The list above indicates the sections assigned to the newsletter <strong><?php echo $rsN->fields[1]; ?></strong>.<br>
<br>
Make ue of the up and down arrow keys next to each section title to change the order in which the sections will appear and click on the "Apply" button.
</td>
</tr>
<tr>
<td height="100%"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
} else {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Email template control panel</title>
<link rel="stylesheet" type="text/css" href="stylesheet/default_styles.css">
<script language="JavaScript">
function n_window(theurl) {
// set width and height
var the_width=600;
var the_height=300;
// set window position
var from_top=83;
var from_left=100;
// set other attributes
var has_toolbar='no';
var has_location='no';
var has_directories='no';
var has_status='no';
var has_menubar='no';
var has_scrollbars='no';
var is_resizable='no';
// atrributes put together
var the_atts='width='+the_width+',height='+the_height+',top='+from_top+',screenY='+from_top+',left='+from_left+',screenX='+from_left;
the_atts+=',toolbar='+has_toolbar+',location='+has_location+',directories='+has_directories+',status='+has_status;
the_atts+=',menubar='+has_menubar+',scrollbars='+has_scrollbars+',resizable='+is_resizable;
// open the window
window.open(theurl,'',the_atts);
document.location='manageSections.php?id=<?php echo $nl_id; ?>';
}
</script>
</head>
<body bgcolor="#D0ECF8" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td height="110" bgcolor="#016694"><img src="images/spacer.gif" width="1" height="110"></td>
</tr>
<tr>
<td height="2" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="2"></td>
</tr>
<tr>
<td height="2" bgcolor="#016694"><img src="images/spacer.gif" width="1" height="2"></td>
</tr>
<tr>
<td height="30"><img src="images/spacer.gif" width="1" height="30"></td>
</tr>
<tr>
<td class="paddingLeft20">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr>
<td valign="top" align="middle">
<table border="0" cellpadding="0" cellspacing="5">
<tr>
<td height="10"></td>
</tr>
<tr>
<td>
<input type="button" value="Create new section" class="button" onClick="javascript:n_window('addSection.php?pid=<?php echo $nl_id; ?>');"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><hr></td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td class="blackType"><strong>Order sections</strong> - <?php echo $rsN->fields[1]; ?><br></td>
</tr>
<tr>
<td valign="top">
<table border="0" cellspacing="2" cellpadding="4">
<tr>
<td width="60" class="blackType"><strong>Sorry</strong>, but there are no sections to this newsletter.</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td><hr></td>
</tr>
<tr>
<td valign="top" align="middle">
<table border="0" cellpadding="0" cellspacing="5">
<tr>
<td><input type="button" value="Back" class="button" onClick="javascript:document.location='manageSections.php?id=<?php echo $nl_id; ?>';"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="100%"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
}
}
?>