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_old3.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" src="jscripts/tiny_mce/tiny_mce.js"></script>
	<script language="javascript" type="text/javascript">
	tinyMCE.init({
		mode : "textareas",
		theme : "advanced",
		plugins : "paste,fullscreen,table" ,
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,separator,undo,redo,separator,indent,outdent,separator,link,unlink,separator,fullscreen",
		theme_advanced_buttons2 : "selectall,cut,copy,paste,pastetext,pasteword,separator,removeformat,cleanup,separator,forecolor,backcolor,separator,charmap,image",
		//theme_advanced_buttons3_add_before : "tablecontrols,"
		theme_advanced_buttons3 : "tablecontrols,separator,visualaid",
		//theme_advanced_buttons3_add : "separator,fullscreen",
		paste_create_paragraphs : false,
		paste_create_linebreaks : false,
		paste_auto_cleanup_on_paste : true,
		paste_convert_middot_lists : false,
		paste_unindented_list_class : "unindentedList",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_path_location : "bottom"		
	});
	</script>
	<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="10" bgcolor="#016694"><img src="images/spacer.gif" width="1" height="10"></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; ?>">
							<?php /*
							<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"]; ?>">
							<?php /*
							<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="70" 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")){ echo '<input type="hidden" name="gImg" value="' . $h_image . '">'; }?></td>
								<td><input type="file" name="image" size="20" style="height:24px;" value="" accept="image/*"><?php if(($UpdateMode) && ($h_image != "n/a")){ echo '&nbsp;<input type="button" value="View image" onClick="javascript:getImage(' ."'". $h_image . "'". ');" >&nbsp;<input type="button" value="Remove image"  onClick="javascript:removeImg();">'; }?></td>
							</tr>
							<tr>
								<td colspan="2" height="10"></td>
							</tr>
							<tr valign="top">
								<td class="blackTypeBold">Copy:&nbsp;</td>
								<td>
									<textarea name="theBody" cols="60" rows="15"><?php if($UpdateMode){echo $h_copy; }?></textarea>
								</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="70" name="link" id="link" <?php if($UpdateMode){ echo 'value="'.$h_url.'"';}?>></td>
							</tr>
							<tr>
								<td class="blackTypeBold">Web link text:&nbsp;</td>
								<td><input class="textBox2" type="Text" size="70" name="linkText" id="linkText" <?php if($UpdateMode){echo "value=".$h_linktitle; }?>></td>					
							</tr>
							<tr>
								<td height="20"></td>
							</tr>
							<tr>
								<td></td>
								<td><input type="submit" <?php if($UpdateMode){?>value="Update"<?php }else{?>value="Submit"<?php }?> class="button">&nbsp;<input type="button" value="Cancel" class="button" onClick="javascript:document.location='manageNewsletter.php?id=<?php echo $_GET['t'] ?>&pid=<?php echo $_GET['s'] ?>';"></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>