Post by wormopolis on Jul 7, 2010 23:10:06 GMT -6
Browser tested: IE and FF
Placement: Global Footer
Preview:
Drop down list appears next to recipients box. selecting a name will put the username into to recipients box for you.
clicking the "include recipients in message" box will add a line at the top of the message showing everyone who receieved the message
This is what the PM will look like to the recipients. Recipients are shown at the top. a "Reply All" button will appear if box was checked when sending.
"Reply All" button will automatically insert all the same recipients into the "To" box for you.
Placement: Global Footer
<script type="text/javascript">
<!--
// PM member list drop down - Do not repost
// By Wormopolis
// version 1.0
//eventhandler addition found on web by Andy Smith
// http://weblogs.asp.net/asmith/archive/2003/10/06/30744.aspx
var purge = 20; //days before memebers are purged from list
var newReplyAllButtonImage="http://i280.photobucket.com/albums/kk168/SKBundy/reply_to_all.jpg";
if (pb_username!='Guest') {
function XBrowserAddHandler(target,eventName,handlerName) {
if ( target.addEventListener ) {
target.addEventListener(eventName, function(e){target[handlerName](e);}, false);
} else if ( target.attachEvent ) {
target.attachEvent("on" + eventName, function(e){target[handlerName](e);});
} else {
var originalHandler = target["on" + eventName];
if ( originalHandler ) {
target["on" + eventName] = function(e){originalHandler(e);target[handlerName](e);};
} else {
target["on" + eventName] = target[handlerName];
}
}
}
var todayDate=new Date();
var purgeDate=new Date();
purgeDate.setDate(todayDate.getDate()+purge);
var master_mem_list = new Array();
var master_mem_list_DN = new Array();
var master_mem_list_EXP = new Array();
if (document.cookie.indexOf("memb_list=")>-1) {
var placer=document.cookie.indexOf("memb_list=")+10;
var placer_end=document.cookie.indexOf(";",placer);
if (placer_end==-1) placer_end=document.cookie.length;
member_list=unescape(document.cookie.substring(placer,placer_end));
mem_list2=member_list.split(",");
master_mem_list=mem_list2;
}
if (document.cookie.indexOf("memb_list_DN=")>-1) {
var placer=document.cookie.indexOf("memb_list_DN=")+13;
var placer_end=document.cookie.indexOf(";",placer);
if (placer_end==-1) placer_end=document.cookie.length;
member_list=unescape(document.cookie.substring(placer,placer_end));
mem_list2=member_list.split(",");
master_mem_list_DN=mem_list2;
}
if (document.cookie.indexOf("memb_list_EXP=")>-1) {
var placer=document.cookie.indexOf("memb_list_EXP=")+14;
var placer_end=document.cookie.indexOf(";",placer);
if (placer_end==-1) placer_end=document.cookie.length;
member_list=unescape(document.cookie.substring(placer,placer_end));
mem_list2=member_list.split(",");
master_mem_list_EXP=mem_list2;
}
var mem_list1=new Array();
var mem_list1_DN=new Array();
var mem_list1_EXP=new Array();
// look for previously unsaved members in info center:
if (!location.href.match(/board=/i) && !location.href.match(/action=/i)) {
iTbls=document.getElementsByTagName('table');
for (i=0; i<iTbls.length; i++) {
if (iTbls[i].innerHTML.match(/Users In The Past 24 Hours/i) && !iTbls[i].innerHTML.match(/<table/i)){
iTlnks=iTbls[i+1].getElementsByTagName('a');
for (j=1; j<iTlnks.length; j++) {
spt=iTlnks[j].href.indexOf('user=')+5;
u_name=iTlnks[j].href.substring(spt, iTlnks[j].href.length);
d_name=(iTlnks[j].innerHTML.match(/font/i))? iTlnks[j].getElementsByTagName('font')[0].innerHTML : iTlnks[j].innerHTML;
mem_list1.push(u_name);
mem_list1_DN.push(d_name);
mem_list1_EXP.push(purgeDate.getFullYear()+"-"+purgeDate.getMonth()+"-"+purgeDate.getDate());
}
}
}
}
// look for previously unsaved members in member list:
if (location.href.match(/ion=members/i)) {
mems=document.getElementsByTagName('tr');
for (i=0; i<mems.length; i++) {
if (mems[i].cells[0].getElementsByTagName('a')[0] && mems[i].cells[0].getElementsByTagName('a')[0].href.match(/viewprofile/i)) {
clay=mems[i].cells[0].getElementsByTagName('a')[0];
u_name=clay.href.split("user=")[1];
d_name=(clay.getElementsByTagName('font')[0]) ? clay.firstChild.innerHTML : clay.innerHTML;
mem_list1.push(u_name);
mem_list1_DN.push(d_name);
mem_list1_EXP.push(purgeDate.getFullYear()+"-"+purgeDate.getMonth()+"-"+purgeDate.getDate());
}
}
}
// look for previously unsaved members in inbox/outbox:
// look for previously unsaved members in post authors:
if (master_mem_list.length==0) {
master_mem_list=mem_list1;
master_mem_list_DN=mem_list1_DN;
master_mem_list_EXP=mem_list1_EXP;
} else {
for (r=0; r<mem_list1.length; r++) {
var found=false; var replc=-1;
for (s=0; s<master_mem_list.length; s++) {
if (master_mem_list[s]==mem_list1[r]) {
found=true;
replc=s;
}
}
if (!found) {
self.status="memlist appended";
master_mem_list.push(mem_list1[r]);
master_mem_list_DN.push(mem_list1_DN[r]);
master_mem_list_EXP.push(mem_list1_EXP[r]);
} else {
self.status="memlist updated";
master_mem_list[replc]=mem_list1[r];
master_mem_list_DN[replc]=mem_list1_DN[r];
master_mem_list_EXP[replc]=mem_list1_EXP[r];
}
}
}
// cleanup duplicate entries in master list
// and purge members not seen in a while
for (a=0; a<master_mem_list.length; a++) {
if (master_mem_list_EXP[a]) {
temp=master_mem_list_EXP[a].split("-");
chkDate=new Date(temp[0],temp[1],temp[2]);
}
if (!master_mem_list_EXP[a] || todayDate>chkDate) {
for(c=a; c<master_mem_list.length-1; c++) {
master_mem_list[c]=master_mem_list[c+1];
master_mem_list_DN[c]=master_mem_list_DN[c+1];
master_mem_list_EXP[c]=master_mem_list_EXP[c+1];
}
master_mem_list.length--;
master_mem_list_DN.length--;
master_mem_list_EXP.length--;
}
for (b=a+1; b<master_mem_list.length; b++) {
if (master_mem_list[a]==master_mem_list[b] || !master_mem_list_EXP[b]){
for(c=b; c<master_mem_list.length-1; c++) {
master_mem_list[c]=master_mem_list[c+1];
master_mem_list_DN[c]=master_mem_list_DN[c+1];
master_mem_list_EXP[c]=master_mem_list_EXP[c+1];
}
master_mem_list.length--;
master_mem_list_DN.length--;
master_mem_list_EXP.length--;
}
}
}
self.status="";
// sort member list
for (v=0; v<master_mem_list_DN.length-1; v++) {
for (w=v+1; w<master_mem_list_DN.length; w++) {
if (master_mem_list_DN[w]<master_mem_list_DN[v]) {
var tempa = master_mem_list_DN[w];
master_mem_list_DN[w] = master_mem_list_DN[v];
master_mem_list_DN[v] = tempa;
var tempb = master_mem_list[w];
master_mem_list[w] = master_mem_list[v];
master_mem_list[v] = tempb;
var tempc = master_mem_list_EXP[w];
master_mem_list_EXP[w] = master_mem_list_EXP[v];
master_mem_list_EXP[v] = tempc;
}
}
}
// store master member list in cookie for global use
date_exp=new Date();
date_exp.setYear(date_exp.getFullYear()+1);
document.cookie="memb_list="+escape(master_mem_list)+"; expires="+date_exp;
document.cookie="memb_list_DN="+escape(master_mem_list_DN)+"; expires="+date_exp;
document.cookie="memb_list_EXP="+escape(master_mem_list_EXP)+"; expires="+date_exp;
// modify PM form to include a dropdown
if (location.href.match(/=pmsend/i) && !document.postForm.to.disabled) {
iTpm=document.getElementsByTagName('tr');
for (k=0; k<iTpm.length; k++) {
if (iTpm[k].innerHTML.match(/to:/i) && !iTpm[k].innerHTML.match(/<table/i)){
destCell=iTpm[k].getElementsByTagName('td')[0];
nDiv=document.createElement("div");
nDiv.id="seldiv";
nDiv.align="right";
txtNd= document.createElement('textnode');
txtNd.innerHTML="Member List ";
chkBx= document.createElement('input');
chkBx.type="checkbox";
chkBx.id = "addRecips";
chkBx.name = "addRecips";
txtNd2 = document.createElement('textnode');
txtNd2.innerHTML="Include Recipients in Message";
nSel=document.createElement("select");
nSel.id="memlist";
recipCell2=destCell.nextSibling.getElementsByTagName('input')[0];
recipCell=document.createElement("textarea");
recipCell2.tabIndex="8";
recipCell2.style.display='none';
recipCell2.parentNode.insertBefore(recipCell, recipCell2);
iBr=document.createElement('br');
recipCell.parentNode.insertBefore(iBr,recipCell.nextSibling);
recipCell.value=recipCell2.value;
recipCell.style.height=50;
recipCell.style.width=500;
recipCell.wrap="soft";
recipCell.tabIndex="2";
//nSel.innerHTML="<option value=''>Member Names</option>";
for (jsm=0;jsm<master_mem_list.length;jsm++) {
d_name=master_mem_list_DN[jsm];
u_name=master_mem_list[jsm];
ne_opt=document.createElement("option");
nSel.appendChild(ne_opt);
ne_opt.value=u_name;
ne_opt.innerHTML=d_name;
}
function changeRecips(e) {
vlu=(this.options[this.selectedIndex].value);
txtbx=this.parentNode.parentNode.nextSibling.getElementsByTagName('textarea')[0];
txtbx2=this.parentNode.parentNode.nextSibling.getElementsByTagName('input')[0];
if (txtbx.value!="") txtbx.value+=", ";
txtbx.value+=vlu;
txtbx2.value=txtbx.value;
}
function finalizeRecips(e) {
vlu=this.parentNode.getElementsByTagName('input')[0];
vlu.value=this.value;
}
function addRecipsIntoMessage(e) {
rec="RECIPIENTS: ["+ document.postForm.to.value + "]\n\n";
addRecip=document.getElementById('addRecips');
if (addRecip.checked) document.postForm.message.value = rec + document.postForm.message.value;
}
var theRecipList= nSel;
theRecipList.ClickHandler = changeRecips;
var theRealRecipList = recipCell;
theRealRecipList.ClickHandler = finalizeRecips;
postForm.ClickHandler = addRecipsIntoMessage;
XBrowserAddHandler(theRecipList,"change","ClickHandler");
XBrowserAddHandler(theRealRecipList,"mouseout","ClickHandler");
XBrowserAddHandler(theRealRecipList,"blur","ClickHandler");
XBrowserAddHandler(postForm,"submit","ClickHandler");
nDiv.appendChild(txtNd);
nDiv.appendChild(nSel);
nDiv.appendChild(iBr.cloneNode(true));
nDiv.appendChild(chkBx);
nDiv.appendChild(txtNd2);
destCell.appendChild(nDiv);
}
}
}
if (location.href.match(/=pmview/i)) {
replyButton=document.getElementsByTagName('a');
for (d=0; d<replyButton.length; d++) {
if (replyButton[d].href.match(/action=pmsend/i)&&replyButton[d].href.match(/view=/i)) {
buttonHolder=replyButton[d];
buttonTray=buttonHolder.parentNode;
msg=replyButton[d].parentNode.parentNode.parentNode.nextSibling;
break;
}
}
if (msg.innerHTML.match(/RECIPIENTS: \[/)) {
recips=msg.innerHTML.substring(msg.innerHTML.indexOf("[")+1,msg.innerHTML.indexOf("]",msg.innerHTML.indexOf("[")));
newReplyAllButton=buttonHolder.cloneNode(true);
temp=newReplyAllButton.href;
temp2=temp.split("to=")[0];
newReplyAllButton.href=temp2+"to="+recips+"&noquote";
NRBimg=newReplyAllButton.getElementsByTagName('img');
if (NRBimg[0]){
NRBimg[0].src=newReplyAllButtonImage;
NRBimg[0].alt="[Reply All]";
}
buttonTray.insertBefore(newReplyAllButton, buttonHolder);
}
}
}
// -->
</script>
Preview:
Drop down list appears next to recipients box. selecting a name will put the username into to recipients box for you.
clicking the "include recipients in message" box will add a line at the top of the message showing everyone who receieved the message
This is what the PM will look like to the recipients. Recipients are shown at the top. a "Reply All" button will appear if box was checked when sending.
"Reply All" button will automatically insert all the same recipients into the "To" box for you.