home *** CD-ROM | disk | FTP | other *** search
- <%
- #include </utility/security.fts>
- #include </utility/global.fts>
- #include </utility/theme.fts>
- #include </utility/ftgate.fts>
- #include </utility/asperrors.fts>
-
- var s = new server.smartpop
- var buildType = build()
-
- session.system.error = 0
-
- var rules=""
-
- // Command values
- // 1 = Add
- // 2 = Delete
- // 3 = Delete All
- // 4 = Change
- //
- if (form.config=="1")
- {
- s.id=form.id
-
- if (form.command=="1")
- {
- s.rule.new()
- s.rule.iffrom=form.iffrom
- s.rule.ifto=form.ifto
- s.rule.ifsubject=form.ifsubject
- s.rule.deliverto=form.deliverto
- }
- else if (form.command=="2")
- {
- var entry = string(form.rule)
- var index=number(entry.indexof("|",0))
- index=number(entry.slice(0,index))
- s.rule.delete(index)
- }
- else if (form.command=="3")
- {
- while (s.rule.first())
- {
- s.rule.delete(s.rule.id)
- }
- }
- else if (form.command=="4")
- {
- var entry = form.rule
- var start=entry.indexOf("|",0)
- var id = number(entry.slice(0, start))
-
- var ok=s.rule.first()
- while ((s.rule.id!=id)&&(ok!=0))
- ok=s.rule.next()
-
- if (ok)
- {
- s.rule.iffrom=form.iffrom
- s.rule.ifto=form.ifto
- s.rule.ifsubject=form.ifsubject
- s.rule.deliverto=form.deliverto
- }
- }
-
- if (form.redirect!="")
- output.redirect(form.redirect+"?id="+s.id)
- }
- else if (form.config=="2")
- {
- if (form.redirect!="")
- output.redirect(form.redirect+"?id="+form.id)
- }
- else
- {
- s.id=request.id
- }
- %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
- <HTML>
- <HEAD>
- <LINK REL=STYLESHEET HREF="/utility/main<%=nn4%>.css" TYPE="text/css">
- <META name="GENERATOR" content="Microsoft Developer Studio">
- <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <TITLE>SmartPops -- Rules</TITLE>
-
- <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
- <!--
- var dir="<%=buttons%>";
- var pro=<%=build()==FTGATE_PRO%>;
-
- if (!document.images) {}
- else {
- create0 = new Image();
- create0.src = dir+"create.gif";
- create1 = new Image();
- create1.src = dir+"createon.gif";
- refresh0 = new Image();
- refresh0.src = dir+"refresh.gif";
- refresh1 = new Image();
- refresh1.src = dir+"refreshon.gif";
- delete0 = new Image();
- delete0.src = dir+"delete.gif";
- delete1 = new Image();
- delete1.src = dir+"deleteon.gif";
- clear0 = new Image();
- clear0.src = dir+"deleteall.gif";
- clear1 = new Image();
- clear1.src = dir+"deleteallon.gif";
- }
-
- <%
- if (netscape)
- {
- %>
- document.captureEvents(Event.KEYPRESS);
- document.onkeypress = keypress;
-
- function keypress(event)
- {
- if (event.which==13)
- {
- onAddRule();
- return false;
- }
-
- return true;
- }
- <%
- }
- else
- {
- %>
- function keypress()
- {
- if (event.keyCode==13)
- {
- event.returnValue=null;
- onAddRule();
- }
- }
- <%
- }
- %>
-
- function onLoad()
- {
- setPage(6, "SmartPops");
- <%
- if (session.system.error!=0)
- {
- %>
- window.alert(aspError(<%=session.system.error%>)+" (<%=s.name%>)");
- <%
- }
- %>
-
- document.ftgate.iffrom.focus();
- }
-
- function validRule()
- {
- if (document.ftgate.iffrom.value==""&&
- document.ftgate.ifto.value==""&&
- document.ftgate.ifsubject.value=="")
- {
- alert("Enter a rule first.");
- document.ftgate.iffrom.focus();
- return false;
- }
-
- if (document.ftgate.deliverto.value=="")
- {
- alert("Enter a mailbox in the Deliver to: field.");
- document.ftgate.deliverto.focus();
- return false;
- }
-
- return true;
- }
-
- function onChangeRule()
- {
- change('changeA', 'refresh', 0);
-
- var index = document.ftgate.rule.selectedIndex;
- if (index==-1)
- return;
-
- if (!validRule())
- return;
-
- document.ftgate.command.value="4";
- document.ftgate.submit();
- }
-
- function onAddRule()
- {
- change('addA', 'create', 0);
-
- if (!validRule())
- return;
-
- document.ftgate.command.value="1";
- document.ftgate.submit();
- }
-
- function isOK()
- {
- return true;
- }
-
- function onDelete()
- {
- var list = document.ftgate.rule
-
- change("deleteA", "delete", 0);
-
- if (list.selectedIndex!=-1)
- {
- document.ftgate.command.value="2";
- document.ftgate.submit();
- }
- }
-
- function onDeleteAll()
- {
- var list = document.ftgate.rule
-
- change("clearA", "clear", 0);
-
- if (list.length!=0)
- {
- document.ftgate.command.value="3";
- document.ftgate.submit();
- }
- }
-
- function onSelect()
- {
- var list=document.ftgate.rule;
- var index=list.selectedIndex;
-
- if (index!=-1)
- {
- var item;
- var start=0;
-
- entry=document.ftgate.rule.options[index].value;
- start = entry.indexOf("|",start)+1;
- index = entry.indexOf("|",start);
- document.ftgate.iffrom.value=entry.slice(start, index);
- start=index+1
- index = entry.indexOf("|",start);
- document.ftgate.ifto.value=entry.slice(start, index);
- start=index+1
- index = entry.indexOf("|",start);
- document.ftgate.ifsubject.value=entry.slice(start, index);
- start=index+1
- document.ftgate.deliverto.value=entry.slice(start, entry.length);
- }
- }
- //-->
- </SCRIPT>
- <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/cookies.js" TYPE="text/javascript"></SCRIPT>
- <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/core.js" TYPE="text/javascript"></SCRIPT>
- <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/spin.js" TYPE="text/javascript"></SCRIPT>
- <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/time.js" TYPE="text/javascript"></SCRIPT>
- <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/dialog.js" TYPE="text/javascript"></SCRIPT>
- <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/asperrors.js" TYPE="text/javascript"></SCRIPT>
- </HEAD>
-
- <BODY BGCOLOR="white" onLoad="onLoad()" MARGINHEIGHT="0" MARGINWIDTH="0" onkeypress="keypress()">
-
- <TABLE BORDER="0" BGCOLOR="<%=border%>" WIDTH="<%=bodywidth%>" HEIGHT="<%=bodyheight%>" CELLPADDING="0" CELLSPACING="0"><TR><TD> </TD><TD VALIGN="TOP">
-
- <A HREF="index.fts"><SPAN ID="top">SmartPops</SPAN></A><SPAN ID="top"> /</SPAN>
- <SPAN ID="topsel"><%=s.name%></SPAN>
-
- <FORM NAME="ftgate" METHOD="POST" onSubmit="return isOK(this)" ACTION="rules.fts">
- <!-- hidden variables -->
- <INPUT TYPE="HIDDEN" NAME="config" VALUE="1">
- <INPUT TYPE="HIDDEN" NAME="command" VALUE="0">
- <INPUT TYPE="HIDDEN" NAME="name" VALUE="<%=s.name%>">
- <INPUT TYPE="HIDDEN" NAME="id" VALUE="<%=s.id%>">
- <INPUT TYPE="HIDDEN" NAME="redirect" VALUE="">
-
- <!-- start of the tabs -->
- <%
- if (buildType==FTGATE_PRO)
- {
- %>
- <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0">
- <TR>
- <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/left.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
- <TD CLASS="navoff" WIDTH="50" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('smartpop.fts')" CLASS="navoff">General</A></TD>
- <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
- <TD CLASS="navoff" WIDTH="55" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('settings.fts')" CLASS="navoff">Settings</A></TD>
- <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
- <TD CLASS="navoff" WIDTH="55" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('schedules.fts')" CLASS="navoff">Schedules</A></TD>
- <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
- <TD CLASS="navon" WIDTH="50" HEIGHT="18"ALIGN="CENTER"><A HREF="javascript:onLaunch('rules.fts')" CLASS="navon">Rules</A></TD>
- <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/right-s.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
- <TD WIDTH="<%=bodywidth-223%>" HEIGHT="18"> </TD>
- </TR>
- </TABLE>
- <%
- }
- else
- {
- %>
- <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0">
- <TR>
- <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/left.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
- <TD CLASS="navoff" WIDTH="50" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('smartpop.fts')" CLASS="navoff">General</A></TD>
- <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
- <TD CLASS="navoff" WIDTH="55" HEIGHT="18" ALIGN="CENTER"><A HREF="javascript:onLaunch('settings.fts')" CLASS="navoff">Settings</A></TD>
- <TD BGCOLOR="black" WIDTH="1" HEIGHT="18" ALIGN="CENTER"><IMG SRC="/images/1pixel.gif" WIDTH="1" HEIGHT="18"></TD>
- <TD CLASS="navon" WIDTH="50" HEIGHT="18"ALIGN="CENTER"><A HREF="javascript:onLaunch('rules.fts')" CLASS="navon">Rules</A></TD>
- <TD WIDTH="5" HEIGHT="18"><IMG SRC="/images/right-s.gif" VSPACE="0" BORDER="0" WIDTH="5" HEIGHT="18"></TD>
- <TD WIDTH="<%=bodywidth-167%>" HEIGHT="18"> </TD>
- </TR>
- </TABLE>
- <%
- }
- %>
- <!-- end of the tabs -->
-
- <!-- start of the tab body -->
- <TABLE BORDER="0" BGCOLOR="<%=border%>" WIDTH="100%" CELLPADDING="0" CELLSPACING="0"><TR><TD>
- <TABLE <%=table%> CELLPADDING="0" CELLSPACING="0">
- <!-- start of block -->
- <TR>
- <TD VALIGN="TOP">
- <TABLE BORDER="0" WIDTH="100%">
- <!-- sub table goes here -->
- <TR>
- <TD>
- <TABLE CLASS="box" WIDTH="100%">
- <TR>
- <TD>
- <TABLE BORDER="0" WIDTH="100%">
- <TR>
- <TH COLSPAN="2">Inbox Rules</TH>
- </TR>
- <TR>
- <TD>
- <SELECT NAME="rule" SIZE="10" CLASS="SEL100" onChange="onSelect()">
- <%
- var rule=""
- var wm=new server.webmail
-
- var ok = s.rule.first()
- while (ok)
- {
- var bit
- var rule=""
-
- if (s.rule.iffrom!="")
- rule = "If From: contains '"+s.rule.iffrom+"'"
-
- if (s.rule.ifto!="")
- {
- if (s.rule.iffrom!="")
- {
- if (s.rule.ifsubject!="")
- bit=", if "
- else
- bit=", and if "
- }
- else
- bit="If "
-
- rule = rule+bit+"To: contains'"+s.rule.ifto+"'"
- }
-
- if (s.rule.ifsubject!="")
- {
- if (rule!="")
- bit=", and if "
- else
- bit="If "
-
- rule = rule+bit+"Subject: contains'"+s.rule.ifsubject+"'"
- }
-
- rule = rule+" then deliver to '"+s.rule.deliverto+"'"
- %>
- <OPTION VALUE="<%=s.rule.id%>|<%=wm.escape(s.rule.iffrom)%>|<%=wm.escape(s.rule.ifto)%>|<%=wm.escape(s.rule.ifsubject)%>|<%=wm.escape(s.rule.deliverto)%>"><%=wm.escape(rule)%></OPTION>
- <%
- ok=s.rule.next()
- }
- %>
- </SELECT>
- </TD>
- <TD VALIGN="TOP" WIDTH="1%">
- <A onMouseDown="change('deleteA','delete',1)" onMouseOut="change('deleteA','delete',0)"
- HREF="javascript:onDelete()"><IMG SRC="<%=buttons%>delete.gif" WIDTH="20" HEIGHT="20" BORDER="0" NAME="deleteA" ALT="Delete selected rule"></A><P>
- <A onMouseDown="change('clearA','clear',1)" onMouseOut="change('clearA','clear',0)"
- HREF="javascript:onDeleteAll()"><IMG SRC="<%=buttons%>deleteall.gif" WIDTH="20" HEIGHT="20" BORDER="0" NAME="clearA" ALT="Delete all rules"></A>
- </TD>
- </TR>
- </TABLE>
- </TD>
- </TR>
- </TABLE>
- </TD>
- </TR>
- <!-- sub table ends here -->
- <!-- sub table goes here -->
- <TR>
- <TD>
- <TABLE CLASS="box" WIDTH="100%">
- <TR>
- <TD>
- <TABLE BORDER="0" WIDTH="100%">
- <TR>
- <TH COLSPAN="3">Create Rule</TH>
- </TR>
- <TR>
- <TD>From</TD><TD><INPUT TYPE="TEXT" NAME="iffrom" VALUE="" SIZE="<%=size40%>"></TD>
- <TD VALIGN="TOP" ROWSPAN="4">
- <A onMouseDown="change('addA','create',1)" onMouseOut="change('addA','create',0)" HREF="javascript:onAddRule()">
- <IMG SRC="<%=buttons%>create.gif" WIDTH="20" HEIGHT="20" BORDER="0" NAME="addA" ALT="Create new rule"></A><P>
- <A onMouseDown="change('changeA','refresh',1)" onMouseOut="change('changeA','refresh',0)" HREF="javascript:onChangeRule()">
- <IMG SRC="<%=buttons%>refresh.gif" WIDTH="20" HEIGHT="20" BORDER="0" NAME="changeA" ALT="Change selected rule"></A><P>
- </TD>
- </TR>
- <TR>
- <TD>To</TD><TD><INPUT TYPE="TEXT" NAME="ifto" VALUE="" SIZE="<%=size40%>"></TD>
- </TR>
- <TR>
- <TD>Subject</TD><TD><INPUT TYPE="TEXT" NAME="ifsubject" VALUE="" SIZE="<%=size40%>"></TD>
- </TR>
- <TR>
- <TD>Deliver to</TD><TD><INPUT TYPE="TEXT" NAME="deliverto" VALUE="" SIZE="<%=size40%>"></TD>
- </TR>
- </TABLE>
- </TD>
- </TR>
- </TABLE>
- </TD>
- </TR>
- <!-- table footer goes here -->
- <TR>
- <TD ALIGN="RIGHT">
- <A HREF="javascript:onClose()"
- onMouseDown="change('closeA', 'ok', 1)"
- onMouseOut="change('closeA', 'ok', 0)"><IMG SRC="<%=buttons%>ok.gif" NAME="closeA" BORDER="0" WIDTH="50" HEIGHT="20" ALT="Apply changes and close" HSPACE="5"></A>
- </TD>
- </TR>
- <!-- table footer ends here -->
- </TABLE>
- </TD>
- </TR>
- <!-- end of block -->
- </TABLE>
- <!-- end of the tab body -->
- </TD></TR></TABLE>
-
- <!-- footer starts here -->
- <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
- <!--
- var href="/smartpop/rules.fts?id=<%=s.id%>";
- var bodywidth=<%=bodywidth%>;
- //-->
- </SCRIPT>
- <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/footer.js" TYPE="text/javascript"></SCRIPT>
- <!-- footer ends here -->
- </FORM>
- </TD><TD WIDTH="10"> </TD></TR></TABLE>
- </BODY>
- </HTML>
-