<?php
#
# Defaults
#
if(!isset($RRN)) { $RRN='*INS*'; }
if(!isset($publish)){ $publish=$_POST[r_pub]; }
if(!isset($target)) { $target='b'; }
#
# Set radios
#
switch($publish)
{
case 0: $r_pub_no='checked'; break;
case 1: $r_pub_yes='checked'; break;
case 2: $r_pub_test='checked'; break;
}
switch($target)
{
case 'b': $r_tgt_blank='checked'; break;
case 's': $r_tgt_self='checked'; break;
}
#
# Input classes
#
for($i=1;$i<=10;$i++) { $fld_class[$i]='form'; }
if(isset($err_i)) { $fld_class[$err_i]='rev'; }
#
# Prepare the code to accept dates
#
include($_SERVER[DOCUMENT_ROOT].$_SESSION[misc][folder].'common/includes/set_month_ary.php');
$opt_yy=Array(); $this_year=date('Y'); $first_year=$this_year-1; for($i=$first_year;$i<=$this_year; $i++) { $opt_yy[$i]=$i; }
#
# news date
#
$htm_n_dat=F_NWSPNL_STR10.'<br /><select class="'.$fld_class[2].'" name="n_date_dd" size="1">';
for($i=0;$i<32;$i++)
{
if($i==$_POST[n_date_dd]) { $htm_n_dat.='<option class="form" value="'.$_POST[n_date_dd].'" selected="'.$_POST[n_date_dd].'">'.$_POST[n_date_dd].'</option>'; }
else { $htm_n_dat.='<option class="form" value="'.str_pad($i,2,'0',STR_PAD_LEFT).'">'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>'; }
}
$htm_n_dat.='</select>';
$htm_n_dat.='<select class="'.$fld_class[2].'" name="n_date_mm" size="1">';
foreach($opt_mm as $key=>$val)
{
if($key==$_POST[n_date_mm]) { $htm_n_dat.='<option class="form" value="'.$_POST[n_date_mm].'" selected="'.$_POST[n_date_mm].'">'.$opt_mm[$_POST[n_date_mm]].'</option>'; }
else { $htm_n_dat.='<option class="form" value="'.$key.'">'.$val.'</option>'; }
}
$htm_n_dat.='</select>';
$htm_n_dat.='<select class="'.$fld_class[2].'" name="n_date_yy" size="1">';
foreach($opt_yy as $key=>$val)
{
if($val==$_POST[n_date_yy]) { $htm_n_dat.='<option class="form" value="'.$_POST[n_date_yy].'" selected="'.$_POST[n_date_yy].'">'.$_POST[n_date_yy].'</option>'; }
else { $htm_n_dat.='<option class="form" value="'.$key.'">'.$val.'</option>'; }
}
$htm_n_dat.='</select>';
#
# expiry date
#
#
$htm_e_dat=F_NWSPNL_STR11.'<br /><select class="'.$fld_class[4].'" name="e_date_dd" size="1">';
for($i=0;$i<32;$i++)
{
if($i==$_POST[e_date_dd]) { $htm_e_dat.='<option class="form" value="'.$_POST[e_date_dd].'" selected="'.$_POST[e_date_dd].'">'.$_POST[e_date_dd].'</option>'; }
else { $htm_e_dat.='<option class="form" value="'.str_pad($i,2,'0',STR_PAD_LEFT).'">'.str_pad($i,2,'0',STR_PAD_LEFT).'</option>'; }
}
$htm_e_dat.='</select>';
$htm_e_dat.='<select class="'.$fld_class[4].'" name="e_date_mm" size="1">';
foreach($opt_mm as $key=>$val)
{
if($key==$_POST[e_date_mm]) { $htm_e_dat.='<option class="form" value="'.$_POST[e_date_mm].'" selected="'.$_POST[e_date_mm].'">'.$opt_mm[$_POST[e_date_mm]].'</option>'; }
else { $htm_e_dat.='<option class="form" value="'.$key.'">'.$val.'</option>'; }
}
$htm_e_dat.='</select>';
$htm_e_dat.='<select class="'.$fld_class[4].'" name="e_date_yy" size="1">';
if($_POST[e_date_yy]=='0000')
{
$htm_e_dat.='<option class="form" value="0000">0000</option>';
}
else
{
foreach($opt_yy as $key=>$val)
{
if($val==$_POST[e_date_yy]) { $htm_e_dat.='<option class="form" value="'.$_POST[e_date_yy].'" selected="'.$_POST[e_date_yy].'">'.$_POST[e_date_yy].'</option>'; }
else { $htm_e_dat.='<option class="form" value="'.$key.'">'.$val.'</option>'; }
}
}
$htm_e_dat.='<option class="form" value="0000">0000</option>'; # Never expiry
$htm_e_dat.='</select>';
?>
<form name="camaleo" method="post" action="<?=$_SERVER[PHP_SELF]?>">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2"><h1><?=F_NWSPNL_TITLE?></h1><?=F_NWSPNL_STR1?><input class="form" type="hidden" name="once" value="<?=$_POST[once]?>" size="1" maxlength="1"></td>
</tr>
<?php
if($_SESSION[news_mngr]==0)
{
?><tr>
<td colspan="2">
<fieldset class="form"><legend class="form"> <?=F_NWSPNL_STR13?> </legend>
<select class="form" name="n_list" size="1">
<?php
$t=count($file_list);
for($i=0;$i<$t;$i++)
{
?><option class="form" value="<?=$file_list[$i][RRN]?>"<?php
if($file_list[$i][RRN]==$_POST[n_list]) { ?> selected="<?=$file_list[$i][RRN]?>"<?php }
?>><?=$file_list[$i][news_date]?>, <?=$file_list[$i][news_msg]?>... {Publish:<?=$file_list[$i][news_publish]?>, ID:<?=$file_list[$i][RRN]?>}</option><?php
}
?>
</select> <input class="button" type="submit" name="submit" value="<?=B_EDIT?>"><div align="right" style="margin:5px 0 0 0;"><input class="button_red" type="submit" name="submit" value="<?=B_DELETE?>"></div>
</fieldset>
</td>
</tr>
<tr>
<td align="left"><input class="button" type="submit" name="submit" value="<?=B_ADD?>"></td>
<td align="right"><input class="button" type="submit" name="submit" value="<?=B_NEWS_ACT?>"> <input class="button_red" type="submit" name="submit" value="<?=B_NEWS_DACT?>"></div></td>
</tr><?php
}
if($_SESSION[news_mngr]==1)
{
?><tr>
<td colspan="2">
<fieldset class="form"><legend class="form"> <?=F_NWSPNL_STR2?><b><?=$RRN?></b>) </legend>
<input class="form" type="hidden" name="RRN" value="<?=$RRN?>" size="12" maxlength="12">
<?=$htm_n_dat?><br />
<img src="img/trasp.gif" height="5px" width="100%" /><br />
<?=F_NWSPNL_STR3?><br /><textarea class="<?=$fld_class[3]?>" name="message" rows="6" cols="45" style="width:99%;"><?=$message?></textarea>
<br />
<img src="img/trasp.gif" height="5px" width="100%" /><br />
<?=F_NWSPNL_STR4?><br />
<input type="radio" name="r_pub" value="1" <?=$r_pub_yes?>><?=YES?>
<input type="radio" name="r_pub" value="0" <?=$r_pub_no?>><?=NO?>
<input type="radio" name="r_pub" value="2" <?=$r_pub_test?>><?=F_NWSPNL_STR5?>
<br />
<img src="img/trasp.gif" height="5px" width="100%" /><br />
<?=$htm_e_dat?>
</fieldset>
</td>
</tr>
<tr>
<td colspan="2">
<fieldset class="form"><legend class="form"> <?=F_NWSPNL_STR6?> </legend>
<?=F_NWSPNL_STR7?><br /><input class="<?=$fld_class[5]?>" type="text" name="news_link" value="<?=$news_link?>" size="50" maxlength="200" style="width:99%;">
<br />
<img src="img/trasp.gif" height="5px" width="100%" /><br />
<?=F_NWSPNL_STR14?>
<input type="radio" name="r_target" value="b" <?=$r_tgt_blank?>><?=F_NWSPNL_STR8?>
<input type="radio" name="r_target" value="s" <?=$r_tgt_self?>><?=F_NWSPNL_STR9?>
</fieldset>
</td>
</tr>
<tr><td colspan="2" align="center"><input class="button" type="submit" name="submit" value="<?=B_SAVE?>"> <input class="button" type="submit" name="submit" value="<?=B_BACKSCR?>"></td></tr>
<tr><td colspan="2" align="center"><?=$feedback_str?></td></tr>
<?
}
?></table>
</form>
<?php
switch($err_i)
{
case 1: ?><script>document.forms['camaleo'].n_list.focus();</script><?php break;
case 2: ?><script>document.forms['camaleo'].n_date_dd.focus();</script><?php break;
case 3: ?><script>document.forms['camaleo'].message.focus();</script><?php break;
case 4: ?><script>document.forms['camaleo'].e_date_dd.focus();</script><?php break;
case 5: ?><script>document.forms['camaleo'].news_link.focus();</script><?php break;
default:
if($_SESSION[news_mngr]==0)
{
?><script>document.forms['camaleo'].n_list.focus();</script><?php
}
else
{
?><script>document.forms['camaleo'].n_date_dd.focus();</script><?php
}
}
echo $pop;
?>