Post by michael2 on Dec 29, 2004 17:19:21 GMT
Here is a code i made it makes a new page and can be edited in the admin area
Place this in your main header
Place this in your main footer
Place this in your main header
<script language="JavaScript">
/*
Create a page admin area editable v2
Coded by Michael Burrows
Main header
Use freely but do not post in other locations please
*/
var tT="New Page Table Title";
var bT="New Page Body Text";
var pT="New Page Window Title";
var pL="newpage";
var cB="NO";
var mL="";
var sP="NO";
if(location.href.indexOf('&type=editpage') != -1){
document.write('<table border="0" align="center" width="70%" cellspacing="1" class="bordercolor" cellpadding="1"><tr><td class="titlebg" align="left"><font color="Black">Edit Page</font><tr><td class="windowbg" align="center">Change the table title:<tr><td class="windowbg" align="center"><textarea name="tT" id="tT" cols="50" rows="10">'+tT.replace(/<br\/>/ig,"\b")+'<\/textarea><tr><td class="windowbg" align="center">Use <*br*> when you want to use a line break and take out the *<br\>Change the body text:<tr><td class="windowbg" align="center"><textarea name="bT" id="bT" cols="50" rows="10">'+bT.replace(/<br\/>/ig,"\b")+'<\/textarea><tr><td class="windowbg" align="center">Change the window title of your page:<tr><td class="windowbg" align="center"><textarea name="pT" id="pT" cols="50" rows="10">'+pT.replace(/<br\/>/ig,"\b")+'<\/textarea><tr><td class="windowbg" align="center">Change the URL of the page:<tr><td class="windowbg" align="center"><input type="textbox" name="pL" id="pL" value="'+pL.replace(/<br\/>/ig,"\b")+'"></input><tr><td class="windowbg" align="center">Menu bar image settings:<tr><td class="windowbg" align="center">Show menu bar image? <select name="cB" id="cB"><option value="YES">Yes</option><option value="NO">No</option></select><br\>Menu bar image URL: <input type="textbox"name="mL" id="mL" value="'+mL.replace(/<br\/>/ig,"\b")+'"></input><tr><td class="windowbg" align="center">Show Page?<tr><td class="windowbg" align="center"><select name="sP" id="sP"><option value="YES">Yes</option><option value="NO">No</option></select></td></tr></table>');
var b = document.getElementById("cB");
for(u=0;u<b.length;u++){
if(b[u].value==cB){
b[u].selected = "true"
var c = document.getElementById("sP");
for(t=0;t<c.length;t++){
if(c[t].value==sP){
c[t].selected = "true"
}}}}}
</script>
Place this in your main footer
<script language="JavaScript">
/*
Create a page admin area editable v2
Coded by Michael Burrows
Main footer
Use freely but do not post in other locations please
*/
if(location.href.indexOf('action=admin') != -1){
var vR = document.getElementsByTagName('TD');
for(o=0;o<vR.length;o++){
if(vR[o].width=='50%' && vR[o].vAlign=='top' && vR[o].innerHTML.match(/Modify Headers and Footers/i)){
vR[o].innerHTML = vR[o].innerHTML.replace(/Modify Headers and Footers/ig,'Modify Headers and Footers</a><br\><a href="index.cgi?action=headersfooters&type=editpage">Edit Page</a>');
}}}
if(sP.match(/^YES$/i)){
if(location.href.indexOf('action='+pL+'') != -1){
document.title=""+pT+""
var fC = document.getElementsByTagName('TD');
for(i=0;i<fC.length;i++){
if(fC[i].width=='100%' && fC[i].vAlign=='top' && fC[i].innerHTML.match(/This feature is not complete yet./i)){
fC[i].innerHTML = fC[i].innerHTML.replace(/An Error Has Occurred!/i,''+tT+'')
fC[i].innerHTML = fC[i].innerHTML.replace(/This feature is not complete yet./i,''+bT+'')
}}}}
if(document.referrer.indexOf('&type=editpage') != -1){
document.title = document.title.split('-')[0] + ' - Edit Page'
var zS = document.getElementsByTagName('TD');
for(u=0;u<zS.length;u++){
if(zS[u].width=='100%' && zS[u].vAlign=='top' && zS[u].innerHTML.match(/Edit Headers \/ Footers/i)){
zS[u].innerHTML = zS[u].innerHTML.replace(/Edit Headers \/ Footers/i,'Edit Page')
zS[u].innerHTML = zS[u].innerHTML.replace(/Your headers and footers have been edited successfully./i,'Your page has been successfully edited.<br\><br\>Your page can be found <a href="/index.cgi?action='+pL+'">here</a>')
}}}
if(location.href.indexOf('&type=editpage') != -1){
var xD = document.getElementsByTagName('table');
for(p=0;p<xD.length;p++){
if(xD[p].className=='bordercolor' && xD[p].cellPadding=='4'){
xD[p].style.display='none'
}}
for(v=0;v<document.forms.length;v++){
if(document.forms[v].action=='index.cgi?action=headersfooters2'){
var vRd = document.forms[v];
vRd.onsubmit=sPk;
vRd.getElementsByTagName('input')[0].style.display='none';
vRd.getElementsByTagName('input')[1].value='Save Page';
}}}
if(cB.match(/^YES$/i)){
document.getElementsByTagName('TD')[5].innerHTML+='<a href="/index.cgi?action='+pL+'"><img src="'+mL+'" border="0"></img>'
}
function sPk(){
var vC = vRd.getElementsByTagName('textarea');
for(f=0;f<vC.length;f++){
if(vC[f].name=='header'){
vC[f].value = vC[f].value.replace(/var tT=".*";/i,'var tT="'+document.getElementById("tT").value+'";');
vC[f].value = vC[f].value.replace(/var bT=".*";/i,'var bT="'+document.getElementById("bT").value+'";');
vC[f].value = vC[f].value.replace(/var pT=".*";/i,'var pT="'+document.getElementById("pT").value+'";');
vC[f].value = vC[f].value.replace(/var pL=".*";/i,'var pL="'+document.getElementById("pL").value+'";');
vC[f].value = vC[f].value.replace(/var cB=".*";/i,'var cB="'+document.getElementById("cB").value+'";');
vC[f].value = vC[f].value.replace(/var mL=".*";/i,'var mL="'+document.getElementById("mL").value+'";');
vC[f].value = vC[f].value.replace(/var sP=".*";/i,'var sP="'+document.getElementById("sP").value+'";');
break;
}}}
</script>