Post by acoolie530 on May 6, 2005 0:48:28 GMT
Name: Admin edittable news!
Compatibility: Firefox/IE
Placement: Main Header and Footer
Features: G101 Style News. Admin edittable. Top and Bottom Gradients, title, and news are all changeable via the admin area
Edit: Admin Area
Main Header
Main Footer
I was having constant trouble with Textareas for the news title because it changed the "<" and ">" tags into "<" and ">" so i made the textarea into an input. Ofcourse, now it is only one line long. So, for line breaks, use the UBBC code [br]
My first released admin edittable code
Compatibility: Firefox/IE
Placement: Main Header and Footer
Features: G101 Style News. Admin edittable. Top and Bottom Gradients, title, and news are all changeable via the admin area
Edit: Admin Area
Main Header
<script>
//G101 style news - Admin editable! By ACoolie. Do not remove this header
var news = "News"
var title = "Title"
var topgrad = "Top Gradient URL"
var botgrad = "Bottom Gradient URL"
var topheight = "Top Gradient Height"
var botheight = "Bottom Gradient Height"
document.write("<br/><table width='92%' align='center' cellpadding='0' cellspacing='0' border='0'><tr><td height='"+topheight+"' align='center' style='background-image: url("+topgrad+");'>"+title+"</td></tr></table><table width='92%' align='center' cellpadding='0' cellspacing='1' class='bordercolor' border='0'><tr><td align='center' valign='middle' class='windowbg2'>"+news+"</td></tr></table><table width='92%' align='center' cellpadding='0' cellspacing='0' border='0'><tr><td height='"+botheight+"' style='background-image: url("+botgrad+");'>&nb"+"sp;</td></tr></table>")
if (location.href.match(/action=headersfooters&type=news/i)) {
document.write("<table border='0' align='center' width='70%' cellspacing='1' class='bordercolor' cellpadding='2'><tr><td align='left' class='titlebg'><font size='2' class='text1'><b>Edit News</b></font></td></tr><tr><td class='windowbg'><br/><font size='2'>News Title: <input id='newst' name='newst' size='40' value='"+title+"'></input><br/><br/>News (For a new line, use the
tag: <br/><input name='newsall' id='newsall' size='100' value='"+news+"'></input><br/><br/>Top Gradient: <img src='"+topgrad+"' border='0'><br/><input name='topg' id='topg' size='100' value='"+topgrad+"'></input><br/>Top Gradient Height: <input name='toph' id='toph' size='20' value='"+topheight+"'></input><br/><br/>Bottom Gradient: <img src='"+botgrad+"' border='0'><br/><input name='botg' id='botg' size='100' value='"+botgrad+"'></input><br/>Bottom Gradient Height: <input name='both' id='both' size='20' value='"+botheight+"'></input></td></tr></table>")
}
</script>
Main Footer
<script>
//G101 style news - Admin editable! By ACoolie. Do not remove this header
if (location.href.match(/action=admin/i)) {
var iCell = document.getElementsByTagName("td")
for (var g = 0;g < iCell.length;g ++) {
if (iCell.item(g).width == "50%" && iCell.item(g).vAlign == "top") {
iCell.item(g).innerHTML = iCell.item(g).innerHTML.replace(/Modify Headers and Footers<\/a><br\/?>/i,"Modify Headers and Footers</a><br/><a href='/index.cgi?action=headersfooters&type=news'>Edit News</a><br/>")
}
}
}
if (location.href.match(/action=headersfooters&type=news/i)) {
function addNews(){
var iInput = document.getElementsByTagName("textarea")
for (var f = 0;f < iInput.length;f ++) {
if (iInput.item(f).name == "header") {
iInput.item(f).value = iInput.item(f).value.replace("</textarea>","</textarea>")
document.getElementById('newsall').value = document.getElementById('newsall').value.replace("
","<br/>")
iInput.item(f).value = iInput.item(f).value.replace(/var news = \".*\"/i,"var news = \""+document.getElementById('newsall').value+"\"")
iInput.item(f).value = iInput.item(f).value.replace(/var topgrad = \".*\"/i,"var topgrad = \""+document.getElementById('topg').value+"\"")
iInput.item(f).value = iInput.item(f).value.replace(/var topheight = \".*\"/i,"var topheight = \""+document.getElementById('toph').value+"\"")
iInput.item(f).value = iInput.item(f).value.replace(/var botgrad = \".*\"/i,"var botgrad = \""+document.getElementById('botg').value+"\"")
iInput.item(f).value = iInput.item(f).value.replace(/var botheight = \".*\"/i,"var botheight = \""+document.getElementById('both').value+"\"")
iInput.item(f).value = iInput.item(f).value.replace(/var title = \".*\"/i,"var title = \""+document.getElementById('newst').value+"\"")
}
}
}
document.title = document.title.replace(/Edit Headers \/ Footers/i,"Edit News")
for (var h = 0;h < document.forms.length;h ++) {
if (document.forms.item(h).action == "index.cgi?action=headersfooters2") {
document.forms.item(h).onsubmit = addNews
document.forms.item(h).getElementsByTagName('input').item(0).style.display="none"
document.forms.item(h).getElementsByTagName('input').item(1).value="Save News"
for (var t = 0;t < document.forms.item(h).getElementsByTagName("br").length;t ++) {
document.forms.item(h).getElementsByTagName("br").item(t).style.display = "none"
}
}
}
var iTab = document.getElementsByTagName("table")
for (var w = 0;w < iTab.length;w ++) {
if (iTab.item(w).className == "bordercolor" && iTab.item(w).cellPadding == "4") {
iTab.item(w).style.display = "none"
}
}
}
</script>
I was having constant trouble with Textareas for the news title because it changed the "<" and ">" tags into "<" and ">" so i made the textarea into an input. Ofcourse, now it is only one line long. So, for line breaks, use the UBBC code [b
My first released admin edittable code