Post by SubDevo on Mar 13, 2010 1:24:06 GMT -8
PM All Staff by SubDevo
Tested in IE, FF, Opera, Safari and Chrome.
Have you ever wished to send a PM to only your staff? Now you can!
This code puts an extra link in the top bar (before the "New Message" link) when viewing your inbox or outbox. Clicking it, brings you to the "New PM" page and it automatically fills in the names of all your staff (excluding the staff member creating the PM), and puts a message (you provide in the code) in the message body.
Enjoy!!!
SubDevo
Variables: Edit the Maroon portions.
var fStaff=/^(admin|staff1)$/i; // Staff usernames
Enter your staff user names (NOT display names), separated by a "|".
Do NOT put a "|" after the last name!
var sLink="PM All Staff"; // Link Text or Image URL
Enter either the text for the link or a URL to an image for the link here.
var sMes="[b]PM Sent to All Staff[/b]"; // Text to always appear in the body of PM.
Exactly what it says! This text will always appear at the beginning of the PM body.
Set this to empty "" and nothing will be added to your message.
var showLink=1; // 0=Admin only, 1=Staff only, 3=All members
Set to "0" = Link is only visible to the admin. If set to "1" (default), the link will only be visible to the staff names in the variable "fStaff" above. Setting to "3" causes all members to be able to see the link.
Extra!
You can put a "PM All Staff" link anywhere (including side tables) on your page if you wish.
Just use this as the href in your link HTML. href="index.cgi?action=pmsend&type=staff"
Location: Main Footer
<script type="text/javascript">
<!--
/* PM All Staff by SubDevo */
/* Main Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
var fStaff=/^(admin|staff1)$/i; // Staff usernames
var sLink="PM All Staff"; // Link Text or Image URL
var sMes="[b]PM Sent to All Staff[/b]"; // Text to always appear in the body of PM.
var showLink=1; // 0=Admin only, 1=Staff only, 3=All members
if(document.pmForm&&(pb_username.match((!showLink)?/^admin$/i:fStaff)||showLink==3)){
sLink=(sLink.match(/^http:\/\//i))?'<img border="0" alt="PM All Staff"'+' src="'+sLink+'" \/>':sLink;
var tr=document.pmForm.parentNode.getElementsByTagName("tr")[2].lastChild.firstChild;
tr.innerHTML='<a href="index.cgi?action=pmsend&type=staff">'+sLink+'</a> '+tr.innerHTML;
}
if(location.href.match(/type=staff$/)){ var pF=document.postForm; var n=fStaff.toString();
n=n.slice(3,n.length-4).replace(pb_username,"").replace(/(\|)?\|/g,",");
pF.to.value=n.replace(/^,|,$/g,""); pF.message.value+=sMes;
}
// -->
</script>
Tested in IE, FF, Opera, Safari and Chrome.
Have you ever wished to send a PM to only your staff? Now you can!
This code puts an extra link in the top bar (before the "New Message" link) when viewing your inbox or outbox. Clicking it, brings you to the "New PM" page and it automatically fills in the names of all your staff (excluding the staff member creating the PM), and puts a message (you provide in the code) in the message body.
Enjoy!!!
SubDevo
Variables: Edit the Maroon portions.
var fStaff=/^(admin|staff1)$/i; // Staff usernames
Enter your staff user names (NOT display names), separated by a "|".
Do NOT put a "|" after the last name!
var sLink="PM All Staff"; // Link Text or Image URL
Enter either the text for the link or a URL to an image for the link here.
var sMes="[b]PM Sent to All Staff[/b]"; // Text to always appear in the body of PM.
Exactly what it says! This text will always appear at the beginning of the PM body.
Set this to empty "" and nothing will be added to your message.
var showLink=1; // 0=Admin only, 1=Staff only, 3=All members
Set to "0" = Link is only visible to the admin. If set to "1" (default), the link will only be visible to the staff names in the variable "fStaff" above. Setting to "3" causes all members to be able to see the link.
Extra!
You can put a "PM All Staff" link anywhere (including side tables) on your page if you wish.
Just use this as the href in your link HTML. href="index.cgi?action=pmsend&type=staff"
Location: Main Footer
<script type="text/javascript">
<!--
/* PM All Staff by SubDevo */
/* Main Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
var fStaff=/^(admin|staff1)$/i; // Staff usernames
var sLink="PM All Staff"; // Link Text or Image URL
var sMes="[b]PM Sent to All Staff[/b]"; // Text to always appear in the body of PM.
var showLink=1; // 0=Admin only, 1=Staff only, 3=All members
if(document.pmForm&&(pb_username.match((!showLink)?/^admin$/i:fStaff)||showLink==3)){
sLink=(sLink.match(/^http:\/\//i))?'<img border="0" alt="PM All Staff"'+' src="'+sLink+'" \/>':sLink;
var tr=document.pmForm.parentNode.getElementsByTagName("tr")[2].lastChild.firstChild;
tr.innerHTML='<a href="index.cgi?action=pmsend&type=staff">'+sLink+'</a> '+tr.innerHTML;
}
if(location.href.match(/type=staff$/)){ var pF=document.postForm; var n=fStaff.toString();
n=n.slice(3,n.length-4).replace(pb_username,"").replace(/(\|)?\|/g,",");
pF.to.value=n.replace(/^,|,$/g,""); pF.message.value+=sMes;
}
// -->
</script>