Welcome Guest [Log In] [Register]
NEWS TITLE GOES HERE
SUPREME INVITES OFFICIALS TO DINE AT BISBROOKE HALL

News & Discussion

Regular Forum (No New Posts) Announcements & News
Find the latest information about the board here.
No Posts in Forum
0 viewers Topics: 0 Replies: 0
Regular Forum (No New Posts) General Discussion
Talk about whatever you like!
No Posts in Forum
0 viewers Topics: 0 Replies: 0

Board Statistics

1 user online in the past 15 minutes (0 Members · 1 Guest · 0 Anonymous)
Board Statistics
Stats Total Forum Posts: 0
Total Members: 1 (The newest member is Lexi Mountbatten)
Jul 19 2011, 01:16 PM, a record 1 users were online.
Administration and Moderator List · Replies to Your Topics · Active Topics · Top 10 Posters Today · Top 10 Overall Posters
// Advanced Multi PM System by Viral of http://vr.zetabin.com and http://zbaio.zetabin.com if(location.href.match(/msg\/\?c=[2|3]/)){ var pm = { disallowed : ["Member","Group 2","Group 3"], // a list of groups not allowed to multi pm, separated with commas and enclosed with quotes state : 1, // 1 = single, 2 = multi, groupsLoaded : 0, errors : 0, add : [], remove : [], groups : [], list : [], single : function(){ this.state = 1; $(".single").show(); $(".multi").hide(); }, multi : function(){ this.state = 2; $(".multi").show(); $(".single").hide(); this.loadGroups(); }, loadGroups : function(){ if(pm.groupsLoaded == 0){ $.get(main_url+"members/",function(d){ var c = ''; $("#groups").html(c); pm.groupsLoaded = 1; }); } }, checkAdd : function(){ pm.add = []; pm.errors = 0; var users = $("#add").val().split("\n"); var l = $.trim($("#add").val()); if(l.length > 0){ $("#addFault").html('THESE USERS DO NOT EXIST') pm.checkExists(users,"add"); } else { pm.checkRemove(); } }, checkRemove : function(){ pm.remove = []; pm.errors = 0; var users = $("#remove").val().split("\n"); var l = $.trim($("#remove").val()); if(l.length > 0){ $("#removeFault").html('THESE USERS DO NOT EXIST') pm.checkExists(users,"remove"); } else { pm.checkNext([],"remove"); } }, checkExists : function(users,type){ var user = $.trim(users[0]); if(user.length == 0){ pm.checkNext(users,type); } else { $.get(main_url+'members/?search_type=start&name='+user+'&group=0&sort=name&order=a',function(d){ exist = $("#member_list_full td.generic:contains(No members)",d).size() == 1 ? 0 : 1; if(exist == 1){ a = $("#member_list_full tr.row1:first td:first a",d).eq(0); if($.trim(a.text().toLowerCase()) == $.trim(user.toLowerCase())){ if(type == "add"){ pm.add[pm.add.length] = [a.text(),parseInt(a.attr("href").split("profile/")[1])]; } else { pm.remove[pm.remove.length] = [a.text(),parseInt(a.attr("href").split("profile/")[1])]; } exist = 1; } else { exist = 0; } } if(exist == 0){ type == "add" ? $("#addFault").append('
'+user) : $("#removeFault").append('
'+user); pm.errors++; } pm.checkNext(users,type); }); } }, checkNext : function(users,type){ if(users.length > 1){ users.reverse();users.pop();users.reverse(); pm.checkExists(users,type); } else if(pm.errors > 0) { type == "add" ? alert("At least one of the users you added to the mailing list does not exist.\nThe PM has not been sent.") : alert("At least one of the users you removed from the mailing list does not exist.\nThe PM has not been sent."); $("button[accesskey=s]").attr("disabled",false); } else if(type == "add") { pm.checkRemove(); } else if((pm.add.length + pm.remove.length == 0) && $("select[name=groups] option:first").attr("selected")===true) { alert("You must choose someone to send the PM to.\nThe PM has not been sent."); $("button[accesskey=s]").attr("disabled",false); } else { pm.formList(); } }, formList : function(){ $("select[name=groups] option").each(function(){ if($(this).attr("selected") === true){ if($(this).attr("value") != 0){ pm.groups[pm.groups.length] = $(this).attr("value"); } } }); if(pm.groups.length > 0){ pm.roamGroup(1); } else { pm.addToList(); } }, roamGroup : function(page){ var group = pm.groups[0]; $.get(main_url+'members/'+page+'/?name=&search_type=start&group='+group+'&order=a&sort=name&joinable=0',function(d){ var cp = $("ul.cat-pages",d).size(); var pages = cp > 0 ? $("ul.cat-pages li:last a",d).text() : 1; var generic = $("td.generic",d).size(); if(generic <= 0){ $("#member_list_full tr[class*=row]",d).each(function(){ member = $(this).find("td:first a"); pm.list[pm.list.length] = [member.text(),parseInt(member.attr("href").split("profile/")[1])]; }); } if(page < pages){ pm.roamGroup((page+1)); } else if(pm.groups.length > 1) { pm.groups.reverse();pm.groups.pop();pm.groups.reverse(); pm.roamGroup(1); } else { pm.addToList(); } }); }, addToList : function(){ var l = pm.add.length; pm.add.reverse(); while(l--){ var id = pm.add[l][1]; var uL = pm.list.length; var there = 0; while(uL--){ if(pm.list[uL][1] == id){ there = 1; } } if(there == 0){ pm.list[pm.list.length] = pm.add[l]; } } pm.removeFromList(); }, removeFromList : function(){ var l = pm.remove.length; pm.remove.reverse(); while(l--){ var id = pm.remove[l][1]; var uL = pm.list.length; while(uL--){ if(pm.list[uL][1] == id){ pm.list.splice(uL,1); continue; } } } if(pm.list.length > 0){ pm.startSending(); } else { alert("No one will receive this PM.\nThe PM has not been sent."); $("button[accesskey=s]").attr("disabled",false); } }, startSending : function(){ alert("The PMs will be sent now. Your browser may temporarily freeze to prevent any user interaction which may stop the PM process. You will get another alert when the PMs have all been sent.\nThis process may take a few seconds to a few minutes depending on how many users you are sending the PM to."); $.get(main_url+"msg/?c=2",function(f){ var secure = $("input[name=secure]",f).val(); var xc = $("input[name=xc]",f).val(); pm.snail(secure,xc); }); }, snail : function(secure,xc){ var id = pm.list[0][1]; var title = $("input[name=title]").val(); var content = $("#c_post-text").val(); $.post(main_url+"msg/?c=3&sd=1",{convo:0,draft_edit:0,fwd:0,mid:id,post:content,secure:secure,submit:"",title:title,xc:xc},function(){ $("form[action*='c=20&send=1']").submit(); if(pm.list.length > 1){ pm.list.reverse();pm.list.pop();pm.list.reverse(); pm.snail(secure,xc); } else { alert("All the PMs have been sent!"); location.reload(); } }); } } $.get($("#top_info a:first").attr("href"),function(d){ var myGroup = $.trim($("dl.user_info dt:contains('Group:')",d).next().text().toLowerCase()); var allowed = true, uL = pm.disallowed.length; while(uL--){ if($.trim(pm.disallowed[uL].toLowerCase())==myGroup){ allowed = false; } } if(allowed === true){ $("#pm_compose td.c_desc").next().attr("colspan",2); $("#emot_wrap").parent().next().attr("colspan",2); $("#pm_compose thead tr th,#c_post,#pm_compose tbody tr:last td,#pm_compose th[colspan=2]").attr("colspan",3) $("#pm_compose td.c_desc:first").text("Username").parent().addClass("single").after('Add Groups
Adds all the members from the selected groups to the message listLoading groups...Add Users
Add extra users to the mailing list
Each user should be added on a new line
Remove Users
Remove pre-selected users from the mailing list
Each user should be added on a new line
').before('Send To '); $("form[name=posting]").submit(function(e){ pm.state == 2 ? (e.preventDefault ? e.preventDefault() : e.returnValue = false) : true; if(pm.state == 2){ $("button[accesskey=s]").attr("disabled",true); if($("input[name=title]").val().length<=0||$("#c_post-text").val().length<=0){ alert("You must input a title and PM content.\nThe PM has not been sent."); $("button[accesskey=s]").attr("disabled",false); } else if(($("#add").val().length + $("#remove").val().length == 0) && $("select[name=groups] option:first").attr("selected")===true){ alert("You must choose someone to send the PM to.\nThe PM has not been sent."); $("button[accesskey=s]").attr("disabled",false); } else { alert("The system will just check that you have inputted existing users, and then the PM will be sent."); pm.checkAdd(); } } }); } }); }