home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 February
/
CHIP_2_98.iso
/
software
/
pelne
/
optionp
/
iis4_03.cab
/
iimimehd.asp
< prev
next >
Wrap
Text File
|
1997-11-12
|
6KB
|
289 lines
<%@ LANGUAGE=VBScript %>
<% Option Explicit %>
<% Response.Expires = 0 %>
<% if Session("FONTSIZE") = "" then %>
<!--#include file="iito.inc"-->
<% else %>
<%
Const L_NOTIMPLEMENTED_ERRORMESSAGE = "This feature is not yet implemented."
Const L_FILETYPES_TEXT = "File Types"
Const L_REGTYPES_TEXT = "Registered file types:"
Const L_NEWTYPE_TEXT = "New Type..."
Const L_REMOVE_TEXT = "Remove"
Const L_EDIT_TEXT = "Edit..."
Const L_EXT_TEXT = "Extension"
Const L_CONENTTYPE_TEXT = "Content Type (MIME)"
Const L_SELECTITEM_TEXT="Select a mime type to delete."
function heading(width,thestring)
Dim i
width=width - len(thestring)
for i=width to 0 step -1
thestring=thestring & " "
Next
heading=thestring
end function
%>
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY BGCOLOR="#CCCCCC" LINK="#000000" VLINK="#000000" TOPMARGIN=10 TEXT="#000000" onLoad="loadList();loadHelp();">
<FORM name="hiddenform">
<INPUT TYPE="hidden" NAME="index" VALUE=-1>
</FORM>
<FORM NAME="userform">
<P>
<TABLE BORDER=0 BGCOLOR="#CCCCCC" WIDTH=99% CELLPADDING=0 CELLSPACING = 0>
<TR><TD><FONT FACE="HELV,ARIAL" SIZE=1>
<%= L_REGTYPES_TEXT %>
</TD></TR>
</TABLE>
</FORM>
<TABLE BORDER = 1 BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#CCCCCC" BORDERCOLORLIGHT="#CCCCCC" CELLPADDING = 2 CELLSPACING = 0>
<TR>
<TD WIDTH = 75 BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000"><FONT SIZE=1 FACE='HELV'>
<A HREF = "javascript:sortList('ext');">
<%= heading(18,L_EXT_TEXT) %>
</A>
</TD>
<TD WIDTH = 160 BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000"><FONT SIZE=1 FACE='HELV'>
<A HREF = "javascript:sortList('app');">
<%= heading(36,L_CONENTTYPE_TEXT) %>
</A>
</TD>
</TR>
</TABLE>
<SCRIPT LANGUAGE="JavaScript">
function loadList(){
parent.list.location.href = "iimimels.asp";
}
function loadHelp(){
top.title.Global.helpFileName="iipxrdir";
}
function setLastSel(id){
for (var i=0; i < cachedList.length; i++) {
if (cachedList[i].id == id){
document.hiddenform.index.value = i;
return;
}
}
}
function sortList(sortby)
{
i=eval(document.hiddenform.index.value);
if ( i != -1)
{
lastsel = cachedList[i].id
}
if (sortby != listFunc.sortby)
{
listFunc.sortby = sortby;
listFunc.sortAsc = true;
}
else
{
listFunc.sortAsc = !listFunc.sortAsc;
}
var num = parseFloat(cachedList[sortby]);
if (isNaN(num))
{
cachedList.sort(sortOrder);
}
else
{
cachedList.sort(numOrder);
}
if (!listFunc.sortAsc)
{
cachedList.reverse();
}
if ( i != -1)
{
setLastSel(lastsel);
}
loadList();
}
function sortOrder(a,b)
{
if (a[listFunc.sortby] < b[listFunc.sortby])
{
return -1;
}
else
{
if (a[listFunc.sortby] > b[listFunc.sortby])
{
return 1;
}
else
{
return 0;
}
}
}
function moveItem(dir){
}
function addItem(){
i = cachedList.length
listFunc.noupdate = true;
cachedList[i] = new listObj(i,"", "");
cachedList[i].newitem = true;
cachedList[i].updated = true;
document.hiddenform.index.value = i;
loadList();
}
function delItem(){
if (document.hiddenform.index.value != -1){
listFunc.noupdate = true;
i = eval(document.hiddenform.index.value);
cachedList[i].deleted = true;
cachedList[i].updated = true;
<% 'run through the list to find the Next non-deleted item %>
for (var j = (i-1); j >=0; j--) {
if (!cachedList[j].deleted){
break
}
}
document.hiddenform.index.value = j;
loadList();
}
else{
alert("<%= L_SELECTITEM_TEXT %>");
}
}
function crop(thestring,size)
{
<% if Session("FONTSIZE") = "LARGE" then %>
size = size-10;
<% end if %>
if (thestring.length > size)
{
thestring = thestring.substring(0,size) + "...";
}
return thestring;
}
function buildListForm(){
numrows = 0;
for (var i = 0; i < cachedList.length; i++) {
if ((!cachedList[i].deleted) && ((cachedList[i].ext + cachedList[i].app) != "")){
numrows = numrows + 1;
}
}
qstr = "numrows="+numrows;
qstr = qstr+"&cols=ext&cols=app"
parent.parent.hlist.location.href = "iihdn.asp?"+qstr;
<% 'the list values will be grabbed by the hiddenlistform script... %>
}
function SetListVals(){
listForm = parent.parent.hlist.document.hiddenlistform;
j = 0;
for (var i = 0; i < cachedList.length; i++) {
if ((!cachedList[i].deleted) && ((cachedList[i].ext + cachedList[i].app) != "")){
listForm.elements[j++].value = cachedList[i].ext;
listForm.elements[j++].value = cachedList[i].app;
cachedList[i].updated = false;
}
}
}
function listFuncs(){
this.sortList = sortList;
this.sortby = "ext";
this.sortAsc = true;
this.addItem = addItem;
this.delItem = delItem;
this.writeList = buildListForm;
this.SetListVals = SetListVals;
openedby = top.opener.location.href;
if (openedby.indexOf("comp") > -1){
top.poptools.toolFunc.mainframe = top.opener.top.opener.top;
}
this.noupdate = false;
}
listFunc = new listFuncs();
function listObj(i,e,a){
this.id = i;
this.ext = e;
this.app=a;
this.deleted = false;
this.newitem = false;
this.updated = false;
}
cachedList = new Array();
<%
On Error Resume Next
Dim path, currentobj, aMimeMap, Map, i, mapsize, mext, mtype
path = Session("dpath")
Session("path") = path
Session("SpecObj") = path & "/MimeMap"
if Session("vtype") = "comp" then
Set currentobj=GetObject(path & "/MimeMap")
else
Set currentobj=GetObject(path)
end if
Session("SpecProps")=""
i = 0
aMimeMap = currentobj.GetEx("MimeMap")
for each Map in aMimeMap
mext = Map.Extension
mtype = Map.MimeType
if mext <> "" and mtype <> "" then
%>cachedList[<%= i %>] = new listObj(<%= i %>,"<%= mext %>","<%= mtype %>");<%
i = i+1
end if
Next
%>
</SCRIPT>
</BODY>
</HTML>
<% end if %>