home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 February
/
CHIP_2_98.iso
/
software
/
pelne
/
optionp
/
ins.cab
/
nnexpghd.asp
< prev
next >
Wrap
Text File
|
1997-10-12
|
8KB
|
291 lines
<% Response.Expires = 0 %>
<%
L_PAGETITLE_TEXT = "Microsoft Internet Service Manager"
L_NEWSGROUP_TEXT = "Newsgroup:"
L_ADD_TEXT = "Add"
L_EXPIRATION_ERRORMESSAGE = "You must have at least one newsgroup in an expiration policy."
L_REMOVEEXP_TEXT = "Are you sure you want to remove this newsgroup from the expiration policy?"
L_ENTERNEWSGROUP_TEXT = "Please enter a newsgroup name."
L_NEWSGROUPSON_TEXT = "Newsgroups on"
L_EXPIRATIONPOLICY_TEXT = "expiration policy #"
L_ADDSMALL_TEXT = "add" ' Internal string Do NOT localize
L_REMOVE_TEXT = "remove" ' Internal string Do NOT localize
%>
<% svr = Request("svr") %>
<% id = Request("id") %>
<% a = Request("a") %>
<% groupToAdd = Request("newsgroup") %>
<% removeIndex = Request("removeIndex") %>
<% On Error Resume Next %>
<% Set ExpireObj = Server.CreateObject("NntpAdm.Expiration") %>
<% if Err <> 0 then %>
<script language="javascript">
alert('<% = Err.description %> ');
</script>
<% end if %>
<% REM get server name %>
<% ExpireObj.Server = svr %>
<% REM set service instance %>
<% ExpireObj.ServiceInstance = Session("ServiceInstance") %>
<HTML>
<HEAD>
<% REM Create uForm object and methods %>
<SCRIPT LANGUAGE = "javascript">
var uForm = new Object();
uForm.itemList = new Array();
uForm.selectedItem = 0;
uForm.selectItem = selectItem;
uForm.addGroup = addGroup;
uForm.checkGroup = checkGroup;
uForm.loadList = loadList;
uForm.removeItem = removeItem;
uForm.addItem = addItem;
uForm.newsgroup = "<% = Request("newsgroup") %>";
uForm.cnumGroups = "";
<% REM Determine browser to set pop-up window size %>
<% if Instr(Request.ServerVariables("HTTP_USER_AGENT"),"MSIE") then %>
winstr = "toolbar=no,width=460,height=240,directories=no,status=no,scrollbars=auto,resize=no,menubar=no";
<% else %>
winstr = "toolbar=no,width=460,height=265,directories=no,status=no,scrollbars=auto,resize=no,menubar=no";
<% end if %>
<% REM enumerate expiration policies %>
<% ExpireObj.Enumerate %>
<% REM find index of expiration policy id %>
<% ExpireObjIndex = ExpireObj.FindId( id ) %>
<% REM get expiration policy corresponding to id %>
<% ExpireObj.GetNth( ExpireObjIndex ) %>
<% REM create array for newsgroups associate with policy %>
<% Dim groupArray %>
<% REM Assign array of newsgroups to "groupArray" %>
<% groupArray = ExpireObj.NewsgroupsVariant %>
<% REM Count groups in array %>
<% cnumGroups = groupArray.count %>
<% REM get count of groups so we know whether or not to delete groups if there are less than two %>
uForm.cnumGroups = "<% = UBound(groupArray) %>";
<% low = LBound(groupArray) %>
<% high = UBound(groupArray) %>
<% for i = low To high %>
uForm.itemList[<% = i %>] = new Object();
uForm.itemList[<% = i %>].name = "<% = groupArray(i) %>";
uForm.itemList[<% = i %>].index = "<% = i %>";
<% Next %>
function checkGroup()
{
if (document.userform.newsgroup.value == "")
{
alert("<% = L_ENTERNEWSGROUP_TEXT %>");
document.userform.newsgroup.focus();
return false;
}
return true;
}
function addGroup()
{
if (checkGroup())
{
document.userform.submit();
}
}
<% REM Javascript function selectItem (if IE, reloads list at specified position -- broken in Netscape) %>
function selectItem(index)
{
uForm.selectedItem = index;
<% if Instr(Request.ServerVariables("HTTP_USER_AGENT"),"IE") then %>
if (index == 0)
{
parent.list.location = "nnexpgls.asp"
}
else
{
parent.list.location = "nnexpgls.asp#" + (index-1);
}
<% else %>
parent.list.location = "nnexpgls.asp"
<% end if %>
}
function addItem()
{
win = window.open("nnexpgad.asp?svr=<% = svr %>", "PropWindow",winstr);
if (win.opener == null)
{
win.opener = self;
}
}
function removeItem()
{
if (uForm.cnumGroups < 1 )
{
alert("<% = L_EXPIRATION_ERRORMESSAGE %>");
}
else
{
if (confirm("<% = L_REMOVEEXP_TEXT %>"))
{
var removeIndex = uForm.itemList[uForm.selectedItem].index;
parent.head.location = "nnexpghd.asp?svr=<% = svr %>&a=remove&id=<% = id %>&removeIndex=" + removeIndex;
}
}
}
<% REM Javascript function loadList loads list frame after header is completed %>
function loadList() {
parent.list.location = "nnexpgls.asp?svr=<% = svr %>";
}
</script>
<% REM if "a" is add or remove %>
<% if ((a = L_REMOVE_TEXT) OR (a = L_ADDSMALL_TEXT)) then %>
<% if (a = L_REMOVE_TEXT) then %>
<% REM set new array size to original array size - 1 %>
<% newArraySize = high - 1 %>
<% REM create new array %>
<% dim removeGroupArray() %>
<% REM set size of new array %>
<% redim removeGroupArray(newArraySize) %>
<% REM initialize counter for new array %>
<% newCount = 0 %>
<% REM copy elements of original array preceding deleted element into new array %>
<% For k = low To (removeIndex - 1) %>
<% removeGroupArray(newCount) = groupArray(k) %>
<% newCount = newCount + 1 %>
<% Next %>
<% REM copy elements of original array following deleted element into new array %>
<% For k = (removeIndex + 1) To high %>
<% removeGroupArray(newCount) = groupArray(k) %>
<% newCount = newCount + 1 %>
<% Next %>
<% REM Submit array to server %>
<% On Error Resume Next %>
<% ExpireObj.NewsgroupsVariant = removeGroupArray %>
<% if( Err <> 0) then %>
<script language="javascript">
alert('<% = Err.description %>');
</script>
<% else %>
<% ExpireObj.Set %>
<% end if %>
<% elseif (a = L_ADDSMALL_TEXT) then %>
<% REM Set new array size to old size +1 %>
<% newArraySize = high + 1 %>
<% REM Create new array %>
<% dim addGroupArray() %>
<% REM Set new array size %>
<% redim addGroupArray(newArraySize) %>
<% REM Copy elements of array into new array %>
<% For k = low To high %>
<% addGroupArray(k) = groupArray(k) %>
<% Next %>
<% REM Add new group to end of new array %>
<% addGroupArray(high + 1) = groupToAdd %>
<% REM Submit array to server %>
<% On Error Resume Next %>
<% ExpireObj.NewsgroupsVariant = addGroupArray %>
<% if( Err <> 0) then %>
<script language="javascript">
alert('<% = Err.description %>');
</script>
<% else %>
<% ExpireObj.Set %>
<% end if %>
<% end if %>
<script language="javascript">
self.location = "nnexpghd.asp?svr=<% = svr %>&id=<% = id %>";
</script>
<% end if %>
<TITLE><% = L_PAGETITLE_TEXT %></TITLE>
</HEAD>
<BODY BGCOLOR="#CCCCCC" TEXT="#000000" LINK="#FFFFFF" ALINK="#FFFFFF" VLINK="#FFFFFF" TOPMARGIN=10>
<FORM NAME="userform" ACTION="nnexpghd.asp" METHOD="post" onSubmit="return checkGroup();">
<TABLE BORDER=0>
<TR>
<TD COLSPAN=3>
<P><IMG SRC="images/gnicttl.gif" ALIGN="textmiddle" HEIGHT=10 WIDTH=10> <FONT SIZE=2 FACE="Arial"><B><% = L_NEWSGROUPSON_TEXT %> </B></FONT><FONT SIZE=3 FACE="Times New Roman"><I><% = L_EXPIRATIONPOLICY_TEXT %><% = id %></I><BR> </FONT>
</TD>
</TR>
<TR>
<TD WIDTH=25> </TD>
<TD><FONT SIZE=2 FACE="Arial">
<% = L_NEWSGROUP_TEXT %> <INPUT TYPE = "text" NAME="newsgroup" VALUE="<% = newsgroup %>">
<INPUT TYPE="hidden" NAME="id" VALUE="<% = id %>">
<INPUT TYPE="hidden" NAME="svr" VALUE="<% = svr %>">
<INPUT TYPE="hidden" NAME="a" VALUE="add">
</TD>
<TD>
<TABLE BORDER=0 CELLPADDING=5 CELLSPACING=2>
<TR>
<TD VALIGN="bottom" BGCOLOR="#555555">
<FONT FACE="Arial" SIZE=2>
<B><A HREF="javascript:addGroup();">
<% = L_ADD_TEXT %></A></B>
</FONT>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD WIDTH=25><BR> </TD>
<TD COLSPAN=2 ALIGN="left">
<FONT SIZE=2 FACE="Arial"><BR><B><% = L_NEWSGROUP_TEXT %></B></FONT>
</TD>
</TR>
</TABLE>
</FORM>
<SCRIPT LANGUAGE="javascript">
timeList = setTimeout('loadList()',500);
document.userform.newsgroup.focus();
</SCRIPT>
</BODY>
</HTML>