Skip to content
Snippets Groups Projects
Commit 07325590 authored by deuce's avatar deuce
Browse files

Modify to use msg_area.sub[], NEW msg_area.grp[] and NEW

msg_area.sub[].grp_name JS thingers.

This would probobly have fixed the mysterious off-by-one group problems.
:-(
parent 0b517495
No related branches found
No related tags found
No related merge requests found
Showing
with 68 additions and 76 deletions
......@@ -8,21 +8,12 @@ http_reply.header["Expires"]="0";
var grp=http_request.query.msg_grp;
if(grp=='' || grp==null)
grp=undefined;
var g=parseInt(http_request.query.msg_grp);
var sub=http_request.query.msg_sub;
if(grp=='E-Mail')
sub='mail';
var s=-1;
if(sub != undefined) {
if(msg_area.grp_list[g] != undefined) {
for(stmp in msg_area.grp_list[g].sub_list) {
if(msg_area.grp_list[g].sub_list[stmp].code == sub) {
s=stmp;
}
}
}
if(sub != undefined)
var msgbase = new MsgBase(sub);
}
var message=http_request.query.message;
var m=parseInt(http_request.query.message);
var path=http_request.virtual_path;
......
/*
* Attachment FS emulator
* Request attachments in the form:
* attachments.ssjs/group/sub/messageID/filename
* attachments.ssjs/sub/messageID/filename
*/
load("html_inc/template.ssjs");
......@@ -11,10 +11,9 @@ var path=http_request.path_info.split(/\//);
if(path==undefined) {
error("No path info!");
}
var group=parseInt(path[1]);
var sub=path[2];
var id=parseInt(path[3]);
var filename=path[4];
var sub=path[1];
var id=parseInt(path[2]);
var filename=path[3];
var msgbase = new MsgBase(sub);
if(msgbase.open!=undefined && msgbase.open()==false) {
......
/*
* Inline attachment FS emulator
* Request attachments in the form:
* attachments.ssjs/group/sub/messageID/Content-ID
* attachments.ssjs/sub/messageID/Content-ID
*/
load("html_inc/template.ssjs");
......@@ -11,10 +11,9 @@ var path=http_request.path_info.split(/\//);
if(path==undefined) {
error("No path info!");
}
var group=parseInt(path[1]);
var sub=path[2];
var id=parseInt(path[3]);
var cid=path[4];
var sub=path[1];
var id=parseInt(path[2]);
var cid=path[3];
var msgbase = new MsgBase(sub);
if(msgbase.open!=undefined && msgbase.open()==false) {
......
......@@ -22,13 +22,13 @@ if(http_request.query.Action=="Delete Message(s)") {
errorlist.push("Cannot delete message "+mnum);
continue;
}
if(sub!='mail' && !msg_area.grp_list[g].sub_list[s].is_operator) {
if(!msg_area.grp_list[g].sub_list[s].settings&SUB_DEL) {
if(sub!='mail' && !msg_area.sub[sub].is_operator) {
if(!msg_area.sub[sub].settings&SUB_DEL) {
errorlist.push("Only operators can delete messages!");
errors++;
continue;
}
if(msg_area.grp_list[g].sub_list[s].settings&SUB_DELLAST) {
if(msg_area.sub[sub].settings&SUB_DELLAST) {
if(msgbase.last_msg!=mnum) {
errorlist.push("You can only delete the last post!");
errors++;
......
......@@ -7,10 +7,10 @@ if(msgbase.open!=undefined && msgbase.open()==false) {
if(sub=='mail') {
template.group=new Object;
template.group.number=-1;
template.group.name="E-Mail";
}
else {
template.group=msg_area.grp_list[g];
template.group=msg_area.grp[msg_area.sub[sub].grp_name];
}
if(sub=='mail') {
......@@ -19,8 +19,8 @@ if(sub=='mail') {
template.sub.code="mail";
}
else {
template.sub=msg_area.grp_list[g].sub_list[s];
if(!msg_area.grp_list[g].sub_list[s].can_read)
template.sub=msg_area.sub[sub];
if(!msg_area.sub[sub].can_read)
error("You can't read messages in this sub!");
}
......
/*
* Message FS emulator
* Request messages in the form:
* msgframe.ssjs/group/sub/messageID/filename
* msgframe.ssjs/sub/messageID/filename
*/
load("html_inc/template.ssjs");
......@@ -11,9 +11,8 @@ var path=http_request.path_info.split(/\//);
if(path==undefined) {
error("No path info!");
}
var group=parseInt(path[1]);
var sub=path[2];
var id=parseInt(path[3]);
var sub=path[1];
var id=parseInt(path[2]);
var msgbase = new MsgBase(sub);
......@@ -23,10 +22,10 @@ if(msgbase.open!=undefined && msgbase.open()==false) {
if(sub=='mail') {
template.group=new Object;
template.group.number=-1;
template.group.name="E-Mail";
}
else {
template.group=msg_area.grp_list[group];
template.group=msg_area.grp[msg_area.sub[sub].grp_name];
}
if(sub=='mail') {
......@@ -35,7 +34,7 @@ if(sub=='mail') {
template.sub.code="mail";
}
else {
template.sub=msg_area.grp_list[group].sub_list[sub];
template.sub=msg_area.sub[sub];
}
template.hdr=msgbase.get_msg_header(false,id);
......
......@@ -25,7 +25,7 @@ if(sub=='mail') {
}
else {
msgarray=get_all_message_offsets();
template.can_delete=msg_area.grp_list[g].sub_list[s].is_operator;
template.can_delete=msg_area.sub[sub].is_operator;
}
var total_pages=Math.floor(msgarray.length/max_messages);
var firstpage=0;
......@@ -63,15 +63,15 @@ if(total_pages>1) {
if(currpage==page)
template.pagelinks += '<b>'+(page+1)+'</b> ';
else
template.pagelinks += "<a href=\""+path+'?msg_grp='+g+'&amp;msg_sub='+encodeURIComponent(sub)+'&amp;offset='+(page*max_messages)+'">'+(page+1)+'</a> ';
template.pagelinks += "<a href=\""+path+'?msg_sub='+encodeURIComponent(sub)+'&amp;offset='+(page*max_messages)+'">'+(page+1)+'</a> ';
}
if(offset+max_messages < msgarray.length) {
template.pagelinks+='<a href="'+path+'?msg_grp='+g+'&amp;msg_sub='+encodeURIComponent(sub)+'&amp;offset='+(offset+max_messages)+'">NEXT</a>';
template.pagelinks+='<a href="'+path+'?msg_sub='+encodeURIComponent(sub)+'&amp;offset='+(offset+max_messages)+'">NEXT</a>';
}
if(offset>0) {
template.pagelinks='<a href="'+path+'?msg_grp='+g+'&amp;msg_sub='+encodeURIComponent(sub)+'&amp;offset='+(offset-max_messages)+'">PREV</a> '+template.pagelinks;
template.pagelinks='<a href="'+path+'?msg_sub='+encodeURIComponent(sub)+'&amp;offset='+(offset-max_messages)+'">PREV</a> '+template.pagelinks;
}
}
......@@ -82,12 +82,12 @@ if(sub=='mail') {
template.sub.code="mail";
}
else {
template.title="Messages in "+msg_area.grp_list[g].sub_list[s].description;
template.sub=msg_area.grp_list[g].sub_list[s];
template.title="Messages in "+msg_area.sub[sub].description;
template.sub=msg_area.sub[sub];
}
if(sub!='mail') {
if(! msg_area.grp_list[g].sub_list[s].can_read) {
if(! msg_area.sub[sub].can_read) {
error("You don't have sufficient rights to read this sub");
}
}
......@@ -96,7 +96,14 @@ write_template("header.inc");
last_offset=msgarray.length-1-offset;
template.messages=new Array;
template.group=msg_area.grp_list[g];
if(sub=='mail') {
template.group=new Object;
template.group.name="E-Mail";
template.group.description="E-Mail";
}
else {
template.group=msg_area.grp[msg_area.sub[sub].grp_name];
}
for(displayed=0;displayed<max_messages && last_offset >= 0 && msgarray[last_offset].hdr != null;last_offset--) {
if(msgarray[last_offset].hdr.subject=='')
......
load("html_inc/msgslib.ssjs");
template.group=msg_area.grp_list[g];
template.group=msg_area.grp_list[msg_area.sub[sub].grp_name];
if(sub=='mail') {
template.sub=new Object;
......@@ -8,11 +8,11 @@ if(sub=='mail') {
template.sub.code="mail";
}
else {
template.sub=msg_area.grp_list[g].sub_list[s];
template.sub=msg_area.sub[sub];
}
if(sub!='mail') {
if(! msg_area.grp_list[g].sub_list[s].can_post) {
if(! msg_area.sub[sub].can_post) {
error("You don't have sufficient rights to post in this sub");
}
}
......
load("html_inc/msgslib.ssjs");
template.group=msg_area.grp_list[g];
template.group=msg_area.grp[msg_area.sub[sub].grp_name];
if(sub=='mail') {
template.sub=new Object;
......@@ -8,11 +8,11 @@ if(sub=='mail') {
template.sub.code="mail";
}
else {
template.sub=msg_area.grp_list[g].sub_list[s];
template.sub=msg_area.sub[sub];
}
if(sub!='mail') {
if(! msg_area.grp_list[g].sub_list[s].can_post) {
if(! msg_area.sub[sub].can_post) {
error("You don't have sufficient rights to post in this sub");
}
}
......
load("html_inc/msgslib.ssjs");
template.group=msg_area.grp_list[g];
template.group=msg_area.grp[msg_area.sub[sub].grp_name];
if(sub=='mail') {
template.sub=new Object;
......@@ -8,12 +8,12 @@ if(sub=='mail') {
template.sub.code="mail";
}
else {
template.sub=msg_area.grp_list[g].sub_list[s];
template.sub=msg_area.sub[sub];
}
var hdrs = new Object;
if(sub!='mail') {
if(! msg_area.grp_list[g].sub_list[s].can_post) {
if(! msg_area.sub[sub].can_post) {
error("You don't have sufficient rights to post in this sub");
}
}
......
load("sbbsdefs.js");
load("html_inc/msgslib.ssjs");
if((g==undefined || isNaN(g) || g==-1) && sub=='mail') {
if(sub=='mail') {
template.type="Internet";
template.sub=new Object;
template.sub.description="Internet E-Mail";
......@@ -15,7 +15,7 @@ if((g==undefined || isNaN(g) || g==-1) && sub=='mail') {
template.sub.max_msgs="Unknown";
}
else {
template.sub=msg_area.grp_list[g].sub_list[s];
template.sub=msg_area.sub[sub];
if(template.sub.settings & SUB_FIDO) {
template.type="FidoNet";
template.tagline=template.sub.fidonet_origin;
......
load("html_inc/msgslib.ssjs");
title="Message Subs in "+msg_area.grp_list[g].description;
title="Message Subs in "+msg_area.grp[grp].description;
write_template("header.inc");
template.group=msg_area.grp_list[g];
template.subs=msg_area.grp_list[g].sub_list;
template.group=msg_area.grp[grp];
template.subs=msg_area.grp[grp].sub_list;
write_template("msgs/subs.inc");
write_template("footer.inc");
......
......@@ -5,7 +5,7 @@
</tr>
<<REPEAT groups>>
<tr>
<td class="grouplist"><a class="grouplist" href="subs.ssjs?msg_grp=^^groups:number^^">%%groups:name%%</a></td>
<td class="grouplist"><a class="grouplist" href="subs.ssjs?msg_grp=^^groups:name^^">%%groups:name%%</a></td>
<td class="grouplist">%%groups:description%%</td>
</tr>
<<END REPEAT groups>>
......
<p class="navigation"><a class="navigation" href="http://^^JS:system.inet_addr^^">Home</a> : <a class="navigation" href="/members/">Members</a> : <a class="navigation" href="index.ssjs">Groups</a> : <a class="navigation" href="subs.ssjs?msg_grp=^^group:number^^">%%group:description%%</a> :
<a class="navigation" href="msgs.ssjs?msg_grp=^^group:number^^&amp;msg_sub=^^sub:code^^">%%sub:description%%</a>
<a class="navigation" href="subinfo.ssjs?msg_grp=^^group:number^^&amp;msg_sub=^^sub:code^^">[?]</a><br /></p>
<p class="navigation"><a class="navigation" href="http://^^JS:system.inet_addr^^">Home</a> : <a class="navigation" href="/members/">Members</a> : <a class="navigation" href="index.ssjs">Groups</a> : <a class="navigation" href="subs.ssjs?msg_grp=^^group:name^^">%%group:description%%</a> :
<a class="navigation" href="msgs.ssjs?msg_sub=^^sub:code^^">%%sub:description%%</a>
<a class="navigation" href="subinfo.ssjs?msg_sub=^^sub:code^^">[?]</a><br /></p>
<table class="msg" border="0" width="95%">
<tr class="msg">
<td class="msgheader" nowrap="nowrap">Subject:</td>
......@@ -17,7 +17,7 @@
<tr><td colspan="4"><hr /></td></tr>
<tr>
<td colspan="4">
<object class="msg" type="text/html" border="2" data="msgframe.ssjs/^^group:number^^/^^sub:code^^/^^hdr:number^^" standby="Loading Message ..." width="100%" height="450">
<object class="msg" type="text/html" border="2" data="msgframe.ssjs/^^sub:code^^/^^hdr:number^^" standby="Loading Message ..." width="100%" height="450">
<pre class="leftalign">@@body@@</pre>
</object>
</td>
......@@ -26,8 +26,8 @@
@@JS:if(template.attachments==undefined) '<!--'; else '';@@
<b>Attachments:</b><br />
<<REPEAT attachments>>
<a href="attachments.ssjs/^^group:number^^/^^sub:code^^/^^hdr:number^^/^^attachments:name^^">%%attachments:name%%</a><br />
<a href="attachments.ssjs/^^sub:code^^/^^hdr:number^^/^^attachments:name^^">%%attachments:name%%</a><br />
<<END REPEAT attachments>>
@@JS:if(template.attachments==undefined) '-->'; else '';@@
<p class="msgcenter"><a href="reply.ssjs?msg_grp=^^group:number^^&amp;msg_sub=^^sub:code^^&amp;reply_to=^^hdr:number^^">Reply</a></p>
<p class="msgcenter"><a href="reply.ssjs?msg_sub=^^sub:code^^&amp;reply_to=^^hdr:number^^">Reply</a></p>
<p class="navigation">
<a class="navigation" href="http://^^JS:system.inet_addr^^/">Home</a> : <a class="navigation" href="/members/">Members</a> :
<a class="navigation" href="index.ssjs">Groups</a> : <a class="navigation" href="subs.ssjs?msg_grp=^^group:number^^">%%group:description%%</a> : %%sub:description%%
<a class="navigation" href="subinfo.ssjs?msg_grp=^^group:number^^&amp;msg_sub=^^sub:code^^">[?]</a> -&#062;
<a class="navigation" href="post.ssjs?msg_grp=^^group:number^^&amp;msg_sub=^^sub:code^^&amp;post=new">Post New Message</a></p>
<a class="navigation" href="index.ssjs">Groups</a> : <a class="navigation" href="subs.ssjs?msg_grp=^^group:name^^">%%group:description%%</a> : %%sub:description%%
<a class="navigation" href="subinfo.ssjs?msg_sub=^^sub:code^^">[?]</a> -&#062;
<a class="navigation" href="post.ssjs?msg_sub=^^sub:code^^&amp;post=new">Post New Message</a></p>
<form action="management.ssjs" method="post">
<input type="hidden" name="msg_grp" value="^^group:number^^" />
<input type="hidden" name="msg_sub" value="^^sub:code^^" />
<table class="msglist" cellpadding="5" cellspacing="2" border="0" width="100%">
<tr class="msglist">
......@@ -23,7 +22,7 @@
@@JS:if(@@messages:attachments@@>0) '<img alt="Attachment" src="/graphics/attach_black.gif" />'; else '&nbsp;';@@
</td>
<td>
<a class="msglist" href="msg.ssjs?msg_grp=^^group:number^^&amp;msg_sub=^^sub:code^^&amp;message=^^messages:number^^">%%messages:subject%%</a>
<a class="msglist" href="msg.ssjs?msg_sub=^^sub:code^^&amp;message=^^messages:number^^">%%messages:subject%%</a>
</td>
<td>
%%messages:from%%
......
<form action="savemsg.ssjs" method="post">
<table class="postmsg" border="0" cellspacing="2" cellpadding="0">
<input type="hidden" name="msg_grp" value="%%group:number%%" />
<input type="hidden" name="msg_sub" value="%%sub:code%%" />
<tbody>
<tr>
......
<p class="navigation"><a class="navigation" href="http://^^JS:system.inet_addr^^/">Home</a> : <a class="navigation" href="index.ssjs">Groups</a> : <a class="navigation" href="subs.ssjs?msg_grp=^^group:number^^">%%group:description%%</a> :
<a class="navigation" href="msgs.ssjs?msg_grp=^^group:number^^&msg_sub=^^sub:code^^">%%sub:description%%</a>
<a class="navigation" href="subinfo.ssjs?msg_grp=^^group:number^^&msg_sub=^^sub:code^^">[?]</a></p>
<p class="navigation"><a class="navigation" href="http://^^JS:system.inet_addr^^/">Home</a> : <a class="navigation" href="index.ssjs">Groups</a> : <a class="navigation" href="subs.ssjs?msg_grp=^^group:name^^">%%group:description%%</a> :
<a class="navigation" href="msgs.ssjs?msg_sub=^^sub:code^^">%%sub:description%%</a>
<a class="navigation" href="subinfo.ssjs?msg_sub=^^sub:code^^">[?]</a></p>
<table class="posted" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td class="posted">
<h1>Message posted successfully</h1>
<p class="posted"><a href="msgs.ssjs?msg_grp=^^group:number^^&msg_sub=^^sub:code^^">Return to %%sub:description%%</a></p>
<p class="posted"><a href="msgs.ssjs?msg_sub=^^sub:code^^">Return to %%sub:description%%</a></p>
</td>
</tr>
</tbody>
......
<form action="savemsg.ssjs" method="post">
<table class="replymsg" border="0" cellspacing="2" cellpadding="0">
<input type="hidden" name="msg_grp" value="%%group:number%%" />
<input type="hidden" name="msg_sub" value="%%sub:code%%" />
<input type="hidden" name="reply_to" value="%%number%%" />
<tbody>
......
......@@ -7,8 +7,8 @@
</tr>
<<REPEAT subs>>
<tr>
<td class="sublist"><a class="msglist" href="msgs.ssjs?msg_grp=^^group:number^^&amp;msg_sub=^^subs:code^^">%%subs:name%%</a></td>
<td class="sublist"><a class="msglist" href="subinfo.ssjs?msg_grp=^^group:number^^&amp;msg_sub=^^subs:code^^">[?]</a></td>
<td class="sublist"><a class="msglist" href="msgs.ssjs?msg_sub=^^subs:code^^">%%subs:name%%</a></td>
<td class="sublist"><a class="msglist" href="subinfo.ssjs?msg_sub=^^subs:code^^">[?]</a></td>
<td class="sublist">%%subs:description%%</td>
</tr>
<<END REPEAT subs>>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment