Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/Mailer/
Upload File :
Current File : /var/www/cesa.co.za/Mailer/addArticle_old.php

<?php
	require_once ('includes/globals.php');

	if (isset($_SESSION['database'])) {
		$db = $_SESSION['database'];		
	} else {
		echo "<script>document.location.href='index.php';</script>\n";
	}
	
	if (isset($_SESSION['userid'])) {
		$userid = $_SESSION['userid'];
	} else {
		echo "<script>document.location.href='index.php';</script>\n";
	}

	$h_sectionid = 0;
	$h_title = '';
	$h_copy = '';
	$h_image = '';
	$h_url = '';
	$h_linktitle = '';
	$h_order = 0;
	
	$UpdateMode = False;
	if (isset($_GET['id'])) {
		$h_id = intval($_GET['id']);
		$UpdateMode = True;

		$rsH = $db->Execute("SELECT idSection, sTitle, txtCopy, sImage, sUrl, sLinkTitle, nOrder FROM Headlines\n where idHeadline = " . $h_id);
		if(!$rsH->EOF) { 
			//$h_headlineid = $rsH->fields[0];
			$h_sectionid = $rsH->fields[0];
			$h_title = $rsH->fields[1];
			$h_copy = $rsH->fields[2]; //, ENT_QUOTES);
			$h_image = $rsH->fields[3];
			$h_url = $rsH->fields[4];
			$h_linktitle = $rsH->fields[5];			
			$h_order = $rsH->fields[6];			
		}		
	}
?>
<!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" type="text/javascript">
		function validate() {
			if (document.formOne.title == "") {
				alert("Please supply a title before proceeding");
				return false;
			}
			document.getElementById("theBody").value = document.getElementById("editBox1").innerHTML;
			if (document.formOne.theBody.value == "") {
				alert("Please supply copy for this headline");
				return false;
			}
			return true;
		}
		function getImage(x) {
			n_window("<?php echo $image_resources; ?>"+x);
		}
		function n_window(theurl) {
			// set width and height
			var the_width=200;
			var the_height=200;
			// set window position
			var from_top=80;
			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);
		}
		function removeImg() {
			document.getElementById("gImg").value = "n/a";
			alert("The image will be removed on submission of this form");
		}
		function resetHiddenValue() {
			document.getElementById("theBody").value = document.getElementById("editBox1").innerHTML ;
		}
	</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="0">
						<?php
							if ($UpdateMode) {
						?>
						<form name="formOne" method="post" action="doUpdateArticle.php" onsubmit="return validate();" enctype="multipart/form-data">
							<input type="hidden" name="updateid" value="<?php echo $h_id; ?>">
							<input type="hidden" name="parentid" value="<?php echo $h_sectionid; ?>">
							<input type="hidden" name="theBody" id="theBody" value="<?php echo $h_copy; ?>">
							<input type="hidden" name="s" value="<?php echo $_GET['s']; ?>">
							<input type="hidden" name="t" value="<?php echo $_GET['t']; ?>">
						<?php
							} else {
						?>
						<form name="formOne" method="post" action="doAddArticle.php" onSubmit="return validate();" enctype="multipart/form-data">
							<input type="hidden" name="parentid" value="<?php echo $_GET["pid"]; ?>">
							<input type="hidden" name="theBody" id="theBody" value="">
							<input type="hidden" name="s" value="<?php echo $_GET['s']; ?>">
							<input type="hidden" name="t" value="<?php echo $_GET['t']; ?>">							
						<?php
							}
						?>					
							<tr>
								<td colspan="2" height="20"></td>
							</tr>
							<tr>
								<td class="blackTypeBold">Title for newsletter:&nbsp;</td>
								<td><input class="textBox2" type="text" size="50" name="title" id="title" <?php if($UpdateMode) {?>value="<?php echo $h_title; ?>"<?php }?>></td>
							</tr>
							<tr>
								<td colspan="2" height="10"></td>
							</tr>
							<tr>
								<td class="blackTypeBold">Image for this headline:&nbsp;<?php if(($UpdateMode) && (!$h_image === "n/a")){?><input type="hidden" name="gImg" value="<?php echo $h_image; ?>"><?php }?></td>
								<td><input type="file" name="image" style="font-family:Arial, Verdana, Helvitica;font-size: 10pt;" accept="image/*"><?php if(($UpdateMode) && (!$h_image === "n/a")){?>&nbsp;<input type="button" value="View image" onClick="javascript:getImage('<?php echo $h_image; ?>');" class="button">&nbsp;<input type="button" value="Remove image" class="buttonClass" onClick="javascript:removeImg();"><?php }?></td>
							</tr>
							<tr>
								<td colspan="2" height="10"></td>
							</tr>
							<tr valign="top">
								<td class="blackTypeBold">Copy:&nbsp;</td>
								<td>
									<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#C0C0C0" id="toolbar2">
										<tr>
											<td>
												<div class="imagebutton" id="bold"><img class="image" src="images/bold.gif" style="cursor:hand" alt="Bold" title="Bold" onclick='document.execCommand("Bold");editBox1.focus();'></div>
											</td>
											<td>
												<div class="imagebutton" id="italic"><img class="image" src="images/italic.gif" style="cursor:hand" alt="Italic" title="Italic" onclick='document.execCommand("Italic");editBox1.focus();'></div>
											</td>
											<td>
												<div class="imagebutton" id="underline"><img class="image" src="images/underline.gif" style="cursor:hand" alt="Underline" title="Underline" onclick='document.execCommand("Underline");editBox1.focus();'></div>
											</td>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
											<td>
												<div style="left: 10;" class="imagebutton" id="justifyleft"><img class="image" src="images/justifyleft.gif" style="cursor:hand" alt="Align Left" title="Align Left" onclick='document.execCommand("JustifyLeft");editBox1.focus();'></div>
											</td>
											<td>
												<div style="left: 40;" class="imagebutton" id="justifycenter"><img class="image" src="images/justifycenter.gif" style="cursor:hand" alt="Center" title="Center" onclick='document.execCommand("JustifyCenter");editBox1.focus();'></div>
											</td>
											<td>
												<div style="left: 70;" class="imagebutton" id="justifyright"><img class="image" src="images/justifyright.gif" style="cursor:hand" alt="Align Right" title="Align Right" onclick='document.execCommand("JustifyRight");editBox1.focus();'></div>
											</td>
											<td>&nbsp;</td>
											<td>
												<div style="left: 10;" class="imagebutton" id="insertorderedlist"><img class="image" src="images/orderedlist.gif" style="cursor:hand" alt="Ordered List" title="Ordered List" onclick='document.execCommand("InsertOrderedList");editBox1.focus();'></div>
											</td>
											<td>
												<div style="left: 40;" class="imagebutton" id="insertunorderedlist"><img class="image" src="images/unorderedlist.gif" style="cursor:hand" alt="Unordered List" title="Unordered List" onclick='document.execCommand("InsertUnorderedList");editBox1.focus();'></div>
											</td>
											<td>&nbsp;</td>
											<td>
												<div style="left: 10;" class="imagebutton" id="outdent"><img class="image" src="images/outdent.gif" alt="Outdent" style="cursor:hand" title="Outdent" onclick='document.execCommand("Outdent");editBox1.focus();'></div>
											</td>
											<td>
												<div style="left: 40;" class="imagebutton" id="indent"><img class="image" src="images/indent.gif" alt="Indent" style="cursor:hand" title="Indent" onclick='document.execCommand("Indent");editBox1.focus();'></div>
											</td>
										</tr>
									</table>
									<div id="editBox1" contenteditable style="height:200; width:450; font-family:Verdana, Arial, Helvetica, sans-serif; padding:3;border: thin solid; border-color: Black; border-width: 1; background: White; scrollbar-base-color:grey; overflow=auto;color: #193631;font-size: 10px;" LANGUAGE=javascript onblur="resetHiddenValue()"><?php if($UpdateMode){?><?php echo $h_copy; ?><?php }?></div>
								</td>
							</tr>
							<tr>
								<td height="10" colspan="2"></td>
							</tr>
							<tr>
								<td class="blackTypeBold">Web link:&nbsp;</td>
								<td><input class="textBox2" type="text" size="57" name="link" id="link" <?php if($UpdateMode){?>value="<?php echo $h_url; ?>"<?php }?>></td>
							</tr>
							<tr>
								<td class="blackTypeBold">Web link text:&nbsp;</td>
								<td><input class="textBox2" type="Text" size="43" name="linkText" id="linkText" <?php if($UpdateMode){echo "value=".$h_linktitle; }?>></td>					
							</tr>
							<tr>
								<td height="20"></td>
							</tr>
							<tr>
								<td colspan="2" align="middle"><input type="submit" <?php if($UpdateMode){?>value="Update"<?php }else{?>value="Submit"<?php }?> class="button"></td>
							</tr>
						</form>
						</table>
					</td>
				</tr>
				<tr>
					<td class="blackType">
						<strong>Information</strong><br>
						<br>
						<ul>
							<li><strong>Title</strong> is reserved for a short descriptive <strong>headline</strong> for the article as it will appear in the final newsletter</li>
							<li><strong>Copy</strong> is reserved for the physical body oftext that will make up the bulk of the article. Content may be copied and pasted here from MS Word.</li>
							<li><strong>Web link</strong> is reserved for those articles which will ink to an external website. Please write the complete URL for the link in the form of <strong>http://domain.com</strong></li>
							<li><strong>Web link text</strong></li> is the physical text which will display for the web link. Where <em><strong>X click here</strong></em> is the text, supply <em><strong>X</strong></em>. Please note that the system will automatically add a space after your supplied text. If no text is supplied the text will default to <em><strong>To read more</strong></em>.
						</ul>
					</td>
				</tr>
				<tr>
					<td height="100%"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</body>
</html>