tweak year/agency modifer for queries
[contractdashboard.git] / cutenews / inc / addnews.mdu
blob:a/cutenews/inc/addnews.mdu -> blob:b/cutenews/inc/addnews.mdu
<?PHP <?PHP
if($member_db[1] > 3){ msg("error", "Access Denied", "You don't have permission to add news"); } if($member_db[1] > 3){ msg("error", "Access Denied", "You don't have permission to add news"); }
$orig_cat_lines = file("./data/category.db.php"); $orig_cat_lines = file("./data/category.db.php");
//only show allowed categories //only show allowed categories
$allowed_cats = array(); $allowed_cats = array();
$cat_lines = array(); $cat_lines = array();
foreach($orig_cat_lines as $single_line){ foreach($orig_cat_lines as $single_line){
$ocat_arr = explode("|", $single_line); $ocat_arr = explode("|", $single_line);
if($member_db[1] <= $ocat_arr[3] or ($ocat_arr[3] == '0' || $ocat_arr[3] == '')){ if($member_db[1] <= $ocat_arr[3] or ($ocat_arr[3] == '0' || $ocat_arr[3] == '')){
$cat_lines[] = $single_line; $cat_lines[] = $single_line;
$allowed_cats[] = $ocat_arr[0]; $allowed_cats[] = $ocat_arr[0];
} }
} }
if ($action == "addnews"){ if ($action == "addnews"){
echoheader("addnews", "Add News"); echoheader("addnews", "Add News");
$short_story_id = 'short_story'; $short_story_id = 'short_story';
$full_story_id = 'full_story'; $full_story_id = 'full_story';
// //
// Are we using the WYSIWYG ? // Are we using the WYSIWYG ?
// //
if($config_use_wysiwyg == "yes"){ if($config_use_wysiwyg == "yes"){
$use_wysiwyg = true; $use_wysiwyg = true;
$article_format_options = " $article_format_options = "
<label for='convert'> <label for='convert'>
<input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" disabled > Convert new lines to &lt;br /&gt;</label> <input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" disabled > Convert new lines to &lt;br /&gt;</label>
<br/> <br/>
<label for='html'> <label for='html'>
<input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"dummi\" checked disabled> Use HTML in this article</label> <input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"dummi\" checked disabled> Use HTML in this article</label>
<input type=hidden name=\"if_use_html\" value=\"yes\"> <input type=hidden name=\"if_use_html\" value=\"yes\">
<br/>"; <br/>";
}else{ }else{
$use_wysiwyg = false; $use_wysiwyg = false;
$article_format_options = " $article_format_options = "
<label for='convert'> <label for='convert'>
<input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" checked > Convert new lines to &lt;br /&gt;</label> <input id='convert' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" checked > Convert new lines to &lt;br /&gt;</label>
<br/> <br/>
<label for='html'> <label for='html'>
<input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_use_html\" checked> Use HTML in this article</label> <input id='html' style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_use_html\" checked> Use HTML in this article</label>
<br/>"; <br/>";
} }
echo " echo "
<SCRIPT LANGUAGE=\"JavaScript\"> <SCRIPT LANGUAGE=\"JavaScript\">
function preview(){ function preview(){
if(document.addnews.short_story.value == '' || document.addnews.title.value == ''){ alert('Your article must have at least Title and Short Story'); } if(document.addnews.short_story.value == '' || document.addnews.title.value == ''){ alert('Your article must have at least Title and Short Story'); }
else{ else{
dd=window.open('','prv','height=400,width=750,resizable=1,scrollbars=1') dd=window.open('','prv','height=400,width=750,resizable=1,scrollbars=1')
document.addnews.mod.value='preview';document.addnews.target='prv' document.addnews.mod.value='preview';document.addnews.target='prv'
document.addnews.submit();dd.focus() document.addnews.submit();dd.focus()
setTimeout(\"document.addnews.mod.value='addnews';document.addnews.target='_self'\",500) setTimeout(\"document.addnews.mod.value='addnews';document.addnews.target='_self'\",500)
} }
} }
function increaseTextarea(area){ function increaseTextarea(area){
if (document.getElementById(area).style.height == '') { if (document.getElementById(area).style.height == '') {
document.getElementById(area).style.height = '300px'; document.getElementById(area).style.height = '300px';
} }
else{ else{
var pattern = new RegExp(\"\\\\d+\",'ig'); var pattern = new RegExp(\"\\\\d+\",'ig');
var currHeight = document.getElementById(area).style.height.match(pattern); var currHeight = document.getElementById(area).style.height.match(pattern);
var newHeight = +currHeight + 100; var newHeight = +currHeight + 100;
document.getElementById(area).style.height = newHeight + 'px'; document.getElementById(area).style.height = newHeight + 'px';
} }
} }
function submitForm() { function submitForm() {
//make sure hidden and iframe values are in sync before submitting form //make sure hidden and iframe values are in sync before submitting form
//to sync only 1 rte, use updateRTE(rte) //to sync only 1 rte, use updateRTE(rte)
//to sync all rtes, use updateRTEs //to sync all rtes, use updateRTEs
updateRTE('short_story'); updateRTE('short_story');
updateRTE('full_story'); updateRTE('full_story');
//updateRTEs(); //updateRTEs();
//change the following line to true to submit form //change the following line to true to submit form
return true; return true;
} }
function increaseTextareaBug(){"; function increaseTextareaBug(){";
if($use_wysiwyg){ if($use_wysiwyg){
echo"var area = '$full_story_id'; echo"var area = '$full_story_id';
if (document.getElementById(area).style.height == '') { if (document.getElementById(area).style.height == '') {
document.getElementById(area).style.height = '250px'; document.getElementById(area).style.height = '250px';
} }
else{ else{
var pattern = new RegExp(\"\\\\d+\",'ig'); var pattern = new RegExp(\"\\\\d+\",'ig');
var currHeight = document.getElementById(area).style.height.match(pattern); var currHeight = document.getElementById(area).style.height.match(pattern);
var newHeight = +currHeight + 1; var newHeight = +currHeight + 1;
document.getElementById(area).style.height = newHeight + 'px'; document.getElementById(area).style.height = newHeight + 'px';
}"; }";
} }
echo"} echo"}
onload=focus;function focus(){document.forms[0].title.focus();} onload=focus;function focus(){document.forms[0].title.focus();}
</SCRIPT> </SCRIPT>
<form onSubmit = \"return submitForm();\" method=post name=addnews action=\"$PHP_SELF\"> <form onSubmit = \"return submitForm();\" method=post name=addnews action=\"$PHP_SELF\">
<table border=0 cellpading=0 cellspacing=0 width=\"654\" > <table border=0 cellpading=0 cellspacing=0 width=\"654\" >
<tr> <tr>
<td width=\"75\"> <td width=\"75\">
Title Title
<td width=\"575\" colspan=\"2\"> <td width=\"575\" colspan=\"2\">
<input type=text size=\"55\" name=\"title\" tabindex=1> <input type=text size=\"55\" name=\"title\" tabindex=1>
</tr>"; </tr>";
if($config_use_avatar == "yes"){ if($config_use_avatar == "yes"){
echo"<tr> echo"<tr>
<td width=\"75\"> <td width=\"75\">
Avatar URL Avatar URL
<td width=\"575\" colspan=\"2\"> <td width=\"575\" colspan=\"2\">
<input tabindex=2 type=text size=\"42\" value=\"$member_db[8]\" name=\"manual_avatar\" >&nbsp;&nbsp;&nbsp;<font style=\"font-size:7pt\">(optional)</font> <input tabindex=2 type=text size=\"42\" value=\"$member_db[8]\" name=\"manual_avatar\" >&nbsp;&nbsp;&nbsp;<font style=\"font-size:7pt\">(optional)</font>
</tr>"; </tr>";
} }
/* Old Single Category Code */ /* Old Single Category Code */
if(count($cat_lines) > 0){ if(count($cat_lines) > 0){
echo"<tr id='singlecat'> echo"<tr id='singlecat'>
<td width=\"75\"> <td width=\"75\">
Category Category
<td width=\"575\" colspan=\"2\"> <td width=\"575\" colspan=\"2\">
<select id='selecsinglecat' name=category tabindex=3>\n <select id='selecsinglecat' name=category tabindex=3>\n
<option value=\"\"> </option>\n"; <option value=\"\"> </option>\n";
foreach($cat_lines as $single_line){ foreach($cat_lines as $single_line){
$cat_arr = explode("|", $single_line); $cat_arr = explode("|", $single_line);
$if_is_selected = ""; $if_is_selected = "";
if($category == $cat_arr[0]){ $if_is_selected = " selected "; } if($category == $cat_arr[0]){ $if_is_selected = " selected "; }
echo"<option $if_is_selected value=\"$cat_arr[0]\">$cat_arr[1]</option>\n"; echo"<option $if_is_selected value=\"$cat_arr[0]\">$cat_arr[1]</option>\n";
} }
echo"</select> <a href=\"javascript:ShowOrHide('multicat','singlecat');\" onClick=\"javascript:document.getElementById('selecsinglecat').name='';\">(multiple categories)</a></tr>"; echo"</select> <a href=\"javascript:ShowOrHide('multicat','singlecat');\" onClick=\"javascript:document.getElementById('selecsinglecat').name='';\">(multiple categories)</a></tr>";
} }
/*### /*###
##### New Multy Category Code ##### New Multy Category Code
*/### */###
if(count($cat_lines) > 0){ if(count($cat_lines) > 0){
echo" echo"
<tr style=\"display:none;\" id='multicat'> <tr style=\"display:none;\" id='multicat'>
<td width=\"75\"> <td width=\"75\">
Category Category
<td>"; <td>";
echo'<table width="100%" border="0" cellspacing="0" cellpadding="0" class="panel">'; echo'<table width="100%" border="0" cellspacing="0" cellpadding="0" class="panel">';
foreach($cat_lines as $single_line){ foreach($cat_lines as $single_line){
$cat_arr = explode("|", $single_line); $cat_arr = explode("|", $single_line);
$if_is_selected = ""; $if_is_selected = "";
if($category == $cat_arr[0]){ $if_is_selected = " checked "; } if($category == $cat_arr[0]){ $if_is_selected = " checked "; }
// echo"<input name='category[]' type=checkbox $if_is_selected value=\"$cat_arr[0]\">$cat_arr[1],\n"; // echo"<input name='category[]' type=checkbox $if_is_selected value=\"$cat_arr[0]\">$cat_arr[1],\n";
echo" echo"
<td style='font-size:10px;' valign=top> <td style='font-size:10px;' valign=top>
<label for='cat{$cat_arr[0]}'> <label for='cat{$cat_arr[0]}'>
<input $if_is_selected style='background-color:transparent;border:0px;' type=checkbox name='category[]' id='cat{$cat_arr[0]}' value='{$cat_arr[0]}'>$cat_arr[1]</label>"; <input $if_is_selected style='background-color:transparent;border:0px;' type=checkbox name='category[]' id='cat{$cat_arr[0]}' value='{$cat_arr[0]}'>$cat_arr[1]</label>";
$i++; $i++;
if ($i%4 == 0){ echo'<tr>'; } if ($i%4 == 0){ echo'<tr>'; }
} }
echo"</tr></table> <td> </td> "; echo"</tr></table> <td> </td> ";
} }
echo" echo"
<tr> <tr>
<td width=\"75\" valign=\"top\"> <td width=\"75\" valign=\"top\">
<br />Short Story <br />Short Story
<td>"; <td>";
if ($use_wysiwyg) { if ($use_wysiwyg) {
echo" echo"
<script language=\"JavaScript\" type=\"text/javascript\" src=\"rte/richtext.js\"></script> <script language=\"JavaScript\" type=\"text/javascript\" src=\"rte/richtext.js\"></script>
<script language=\"JavaScript\" type=\"text/javascript\"> <script language=\"JavaScript\" type=\"text/javascript\">
initRTE(\"rte/images/\", \"rte/\", \"rte/\", false); </script> initRTE(\"rte/images/\", \"rte/\", \"rte/\", false); </script>
<script language=\"JavaScript\" type=\"text/javascript\"> <script language=\"JavaScript\" type=\"text/javascript\">
writeRichText('short_story', '', 460, 250, true, false); writeRichText('short_story', '', 460, 250, true, false);
</script> </script>
"; ";
}else{ }else{
echo" echo"
<textarea rows=\"12\" cols=\"74\" id=\"short_story\" name=\"short_story\" tabindex=4></textarea> <textarea rows=\"12\" cols=\"74\" id=\"short_story\" name=\"short_story\" tabindex=4></textarea>
"; ";
} }
echo" echo"
<td width=\"108\" valign=\"top\" style='background: url(skins/images/baloon.gif) no-repeat top left'> <td width=\"108\" valign=\"top\" style='background: url(skins/images/baloon.gif) no-repeat top left'>
<p align=\"center\"><a href=# onclick=\"window.open('$PHP_SELF?&mod=images&action=quick&area=$short_story_id&wysiwyg=$use_wysiwyg', '_Addimage', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\"><br /> <p align=\"center\"><a href=# onclick=\"window.open('$PHP_SELF?&mod=images&action=quick&area=$short_story_id&wysiwyg=$use_wysiwyg', '_Addimage', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\"><br />
[insert image]</a><br /> [insert image]</a><br />
<!-- <a href=# onclick=\"window.open('$PHP_SELF?&mod=about&action=cutecode&target=short_story', '_CuteCode', 'HEIGHT=280,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\">[quick tags]</a><br /> --> <!-- <a href=# onclick=\"window.open('$PHP_SELF?&mod=about&action=cutecode&target=short_story', '_CuteCode', 'HEIGHT=280,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\">[quick tags]</a><br /> -->
<a href=# onclick=\"increaseTextarea('$short_story_id'); return false;\">[expand]</a> <a href=# onclick=\"increaseTextarea('$short_story_id'); return false;\">[expand]</a>
<br /><br /> <br /><br />
"; ";
echo insertSmilies("$short_story_id", 4, true, "$use_wysiwyg"); echo insertSmilies("$short_story_id", 4, true, "$use_wysiwyg");
echo" echo"
</tr> </tr>
<tr id='full-story' style='display:none;z-index:1;'> <tr id='full-story' style='display:none;z-index:1;'>
<td width=\"75\" valign=\"top\"> <td width=\"75\" valign=\"top\">
<br />Full Story<br /><font style=\"font-size:7pt\">(optional)</font> <br />Full Story<br /><font style=\"font-size:7pt\">(optional)</font>
<td> <td>
"; ";
if ($use_wysiwyg) { if ($use_wysiwyg) {
echo"<script language=\"JavaScript\" type=\"text/javascript\"> echo"<script language=\"JavaScript\" type=\"text/javascript\">
writeRichText('full_story', '', 460, 300, true, false); writeRichText('full_story', '', 460, 300, true, false);
</script>"; </script>";
}else{ }else{
echo"<textarea rows=\"12\" cols=\"74\" id=\"full_story\" name=\"full_story\" tabindex=5></textarea>"; echo"<textarea rows=\"12\" cols=\"74\" id=\"full_story\" name=\"full_story\" tabindex=5></textarea>";
} }
echo" echo"
<td width=\"108\" valign=\"top\" style='background: url(skins/images/baloon.gif) no-repeat top left'> <td width=\"108\" valign=\"top\" style='background: url(skins/images/baloon.gif) no-repeat top left'>
<p align=\"center\"><br /> <p align=\"center\"><br />
<a href=# onclick=\"window.open('$PHP_SELF?mod=images&action=quick&area=$full_story_id&wysiwyg=$use_wysiwyg', '_Addimage', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\">[insert image]</a><br /> <a href=# onclick=\"window.open('$PHP_SELF?mod=images&action=quick&area=$full_story_id&wysiwyg=$use_wysiwyg', '_Addimage', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_Addimage\">[insert image]</a><br />
<!-- <a href=# onclick=\"window.open('$PHP_SELF?&mod=about&action=cutecode&target=full_story', '_Addimage', 'HEIGHT=280,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_CuteCode\">[quick tags]</a><br />--> <!-- <a href=# onclick=\"window.open('$PHP_SELF?&mod=about&action=cutecode&target=full_story', '_Addimage', 'HEIGHT=280,resizable=yes,scrollbars=yes,WIDTH=360');return false;\" target=\"_CuteCode\">[quick tags]</a><br />-->
<a href=# onclick=\"increaseTextarea('$full_story_id'); return false;\">[expand]</a> <a href=# onclick=\"increaseTextarea('$full_story_id'); return false;\">[expand]</a>
<br /><br /> <br /><br />
"; ";
echo insertSmilies("$full_story_id", 4, true, "$use_wysiwyg"); echo insertSmilies("$full_story_id", 4, true, "$use_wysiwyg");
echo" echo"
</tr> </tr>
<tr> <tr>
<td> <td>
<td> <td>
<table border=0 cellspacing=0 cellpadding=0 width=100%> <table border=0 cellspacing=0 cellpadding=0 width=100%>
<tr> <tr>
<td width=50%> <td width=50%>
<input type=submit style='font-weight:bold' title=\"Post the New Article\" value=\" Add News \" accesskey=\"s\"> <input type=submit style='font-weight:bold' title=\"Post the New Article\" value=\" Add News \" accesskey=\"s\">
</td> </td>
<td width=50% align=right> <td width=50% align=right>
<input style='width:110px;'type=button onClick=\"ShowOrHide('full-story',''); setTimeout('increaseTextareaBug()',310);\" value=\"Toggle Full-Story\"> <input style='width:90px;' type=button onClick=\"ShowOrHide('options','');\" value=\"Article Options\"> <input style='width:110px;'type=button onClick=\"ShowOrHide('full-story',''); setTimeout('increaseTextareaBug()',310);\" value=\"Toggle Full-Story\"> <input style='width:90px;' type=button onClick=\"ShowOrHide('options','');\" value=\"Article Options\">
</td> </td>
</tr> </tr>
</table> </table>
</tr> </tr>
<tr id='options' style='display:none;'> <tr id='options' style='display:none;'>
<td width=\"75\"><br>Options <td width=\"75\"><br>Options
<td width=\"575\" colspan=\"4\"> <td width=\"575\" colspan=\"4\">
<br> <br>
$article_format_options $article_format_options
<label for='active'><input CHECKED id='active' style=\"border:0; background-color:transparent\" type=radio value=\"active\" name=\"postpone_draft\"> <label for='active'><input CHECKED id='active' style=\"border:0; background-color:transparent\" type=radio value=\"active\" name=\"postpone_draft\">
<b>Normal</b>, add article as active</label> <b>Normal</b>, add article as active</label>
<br /> <br />
<label for='draft'><input id='draft' style=\"border:0; background-color:transparent\" type=radio value=\"draft\" name=\"postpone_draft\"> <label for='draft'><input id='draft' style=\"border:0; background-color:transparent\" type=radio value=\"draft\" name=\"postpone_draft\">
<b>Draft</b>, add article as unapproved</label> <b>Draft</b>, add article as unapproved</label>
<br /> <br />
<label for='postpone'><input id='postpone' style=\"border:0; background-color:transparent\" type=radio value=\"postpone\" name=\"postpone_draft\"> <label for='postpone'><input id='postpone' style=\"border:0; background-color:transparent\" type=radio value=\"postpone\" name=\"postpone_draft\">
<b>Postpone</b>, make article active at</label> <b>Postpone</b>, make article active at</label>
<select name=from_date_day>"; <select name=from_date_day>";
for($i=1;$i<32;$i++){ for($i=1;$i<32;$i++){
if(date("j") == $i){ echo"<option selected value=$i>$i</option> \n"; } if(date("j") == $i){ echo"<option selected value=$i>$i</option> \n"; }
else{ echo"<option value=$i>$i</option> \n"; } else{ echo"<option value=$i>$i</option> \n"; }
} }
echo"</select> \n <select name=from_date_month> \n"; echo"</select> \n <select name=from_date_month> \n";