<?php
include("postget.php");
include_once("common.php");
$pagetitle = _ANNOUNCEMENTS;

checklevel(2,$_REQUEST['clientid']);


/////////////////////////////////////////////////////////// actualizar la pagina web
if ($_POST['announcement']<>'') {
	$now=time()+$config[31][1]*3600;
	
	if($onlyclients=="on"){$onlyclients=1;}else{$onlyclients=0;}
	
	$query="UPDATE hd_announcements SET 
	comment='".$announcement."', 
	status='".$_POST['status']."', 
	priority='".$_POST['priority']."', 
	onlyclients='".$onlyclients."', 
	langs='".$currentlang."' 
	 WHERE id='$id'";
	if(!mysql_query($query,$db_link)){
		message(_ERROR,"DEBUG: ".$query."<br>ERROR: ".mysql_error(),'announcements_admin.php',_RETURN); exit;
	}else{
		go2('announcements_admin.php');
	}
}


if($_REQUEST[id]) {
	$query="SELECT * FROM hd_announcements WHERE id='$_REQUEST[id]'";
	$output=mysql_query($query,$db_link);
	$row=mysql_fetch_array($output);
}
include("head_template.php");


?>
<script language="javascript" type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({




	// General options
	mode : "textareas",
	theme : "advanced",
	plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

	// produce BR en lugar de P
	//	forced_root_block : false,
	//	force_br_newlines : true,
	//	force_p_newlines : false,



	// Theme options
	theme_advanced_buttons1 : "undo,redo,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
	theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,|,forecolor,backcolor",
	theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
	theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,

	//	extended_valid_elements : "input[id|name|type|size|value],textarea[cols|rows]",
	extended_valid_elements : "input[id|name|type|size|value]",


	// Example content CSS (should be your site CSS)
	//	content_css : "css/example.css",

	// Drop lists for link/image/media/template dialogs
	//	template_external_list_url : "js/template_list.js",
	external_link_list_url : "<?php echo $config[1][1]?>/website_linkslist.php",
	external_image_list_url : "<?php echo $config[1][1]?>/website_imagelist.php",
	//	media_external_list_url : "js/media_list.js",

	relative_urls : false,
	remove_script_host : true,
	document_base_url : "<?php echo $config[1][1]?>/website/"

	// Replace values for the template plugin
	//	template_replace_values : {
	//		username : "Some User",
	//		staffid : "991234"
	//	}
});
</script>
<?php

echo '
<div class="container">
	<div class="row">
';

	print("
	<form method='post'>
	<table class='table'>
		<tr>
			<td rowspan='3'>
			<b>".ucfirst(_ANNOUNCEMENT).":</b><br>
			<TEXTAREA cols=150 rows=10 name='announcement'>
			".$row[comment]."
			</TEXTAREA>
			</td>
			<td>
			".ucfirst(_STATUS)."
			<select name='status'>
			<option value='1' ".sele($row['status'],'1').">".ucfirst(_ACTIVE)."</option>
			<option value='2' ".sele($row['status'],'2').">".ucfirst(_INACTIVE)."</option>
			</select>
			</td>
		</tr>
		<tr>
			<td>
			".ucfirst(_PRIORITY)."
			<select name='priority'>
			<option value='low' ".sele($row['priority'],'low').">".ucfirst(_LOW)."</option>
			<option value='medium' ".sele($row['priority'],'medium').">".ucfirst(_MEDIUM)."</option>
			<option value='high' ".sele($row['priority'],'high').">".ucfirst(_HIGH)."</option>
			</select>
			</td>
		</tr>
		<tr>
			<td>
			<input type='checkbox' name='onlyclients'");
	if($_REQUEST[id]){if ($row[onlyclients]==1){print(" checked");};}
	print(">".ucfirst(_VISIBLE_ONLY_TO_REGISTERED_CLIENTS)."
			</td>
		</tr>
	
	</table>
	
	
	<br>
	<input type='submit' name='click' value='"._EDIT."'><br>
	</form>
	");


echo '
</div>
</div>
';


include("foot_template.php");
?>