home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Plus! (NZ) 2000 October
/
PCWORLDPLUS_OCTO.BIN
/
browsers
/
Ie505
/
WIN32
/
EN
/
IEMIL_3.CAB
/
MSHTMLER.DLL
/
HTML
/
INSIMAGE.DLG
< prev
next >
Wrap
Text File
|
2000-06-06
|
12KB
|
377 lines
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
<HTML id=dlgImage STYLE="font-family: MS Shell Dlg; font-size: 8pt;
width: 40.1em; height: 18em">
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>
Picture
</TITLE>
<SCRIPT defer>
function callHelp(elm)
{
if (null != elm.helpid)
{
window.showHelp(elm.helpfile, "" + parseInt(elm.helpid),
"popup");
}
else
{
if ("BODY" != elm.tagName)
{
callHelp(elm.parentElement);
}
}
}
function btnCancelClick()
{
window.close();
}
function getTextRange(elm)
{
var r = elm.parentTextEdit.createTextRange();
r.moveToElementText(elm);
return r;
}
function mouseClick()
{
if (window.event.srcElement.id.substring(0,3)
== "txt")
{
return;
}
if (window.event.button == 2)
{
callHelp(window.event.srcElement);
}
}
function txtDefaultESC()
{
if (event.keyCode == 27)
{
window.close();
return;
}
}
window.onerror = HandleError
var L_Dialog_ErrorMessage = "An error has occurred in this dialog.";
var L_ErrorNumber_Text = "Error: ";
function HandleError(message, url, line)
{
var str = L_Dialog_ErrorMessage + "\n\n"
+ L_ErrorNumber_Text + line + "\n"
+ message;
alert (str);
window.close();
return true;
}
function setOKState(fEvent) { if (fEvent && (event.propertyName != "value")) { return; } if (("" == txtFileName.value) == g_fOKEnabled) { btnOK.disabled = g_fOKEnabled; g_fOKEnabled = !g_fOKEnabled; } } var g_fOKEnabled = false;
function btnBrowseClick()
{
var L_Picture_DIALOG_Title_DialogTitle = "Picture";
var L_Picture_DIALOG_FileTypes_Text = "GIF and JPEG (*.gif, *.jpg)|*.gif;*.jpg|Bitmap (*.bmp)|*.bmp|Windows Metafile (*.wmf)|*.wmf|XBM (*.xbm)|*.xbm|ART (*.art)|*.art|All files (*.*)|*.*|";
var strFileName;
strFileName = dialogHelper.openfiledlg("", "",
L_Picture_DIALOG_FileTypes_Text,L_Picture_DIALOG_Title_DialogTitle);
if ("" != strFileName)
{
txtFileName.value = strFileName;
}
setOKState(false);
}
function getProtocolFromURL(strURL)
{
var index;
return strURL.substring(0, strURL.indexOf(":") + 1);
}
function bdyLoad()
{
var elmSelectedImage;
var htmlSelectionControl = "Control";
var globalDoc = window.dialogArguments;
var grngMaster = globalDoc.selection.createRange();
txtFileName.onfocus = new Function("txtFileName.select()");
txtFileName.onkeypress = new Function("txtDefaultESC()");
txtAltText.onfocus = new Function("txtAltText.select()");
txtAltText.onkeypress = new Function("txtDefaultESC()");
txtHorizontal.onfocus = new Function("txtHorizontal.select()");
txtHorizontal.onkeypress = new Function("txtDefaultESC()");
txtBorder.onfocus = new Function("txtBorder.select()");
txtBorder.onkeypress = new Function("txtDefaultESC()");
txtVertical.onfocus = new Function("txtVertical.select()");
txtVertical.onkeypress = new Function("txtDefaultESC()");
btnBrowse.onclick = new Function("btnBrowseClick()");
btnOK.onclick = new Function("btnOKClick()");
btnCancel.onclick = new Function("btnCancelClick()");
document.onhelp = new Function("callHelp(window.event.srcElement)");
document.onmouseup = new Function("mouseClick()");
txtFileName.onpropertychange = new Function("setOKState(true)");
txtFileName.fImageLoaded = false;
txtFileName.intImageWidth = 0;
txtFileName.intImageHeight = 0;
if (globalDoc.selection.type == htmlSelectionControl)
{
if (grngMaster.length == 1)
{
elmSelectedImage = grngMaster.item(0);
if (elmSelectedImage.tagName == "IMG")
{
txtFileName.fImageLoaded = true;
if (elmSelectedImage.src)
txtFileName.value = elmSelectedImage.src;
txtFileName.intImageHeight = elmSelectedImage.height;
txtFileName.intImageWidth = elmSelectedImage.width;
txtVertical.value = elmSelectedImage.vspace;
txtHorizontal.value = elmSelectedImage.hspace;
txtBorder.value = elmSelectedImage.border;
txtAltText.value = elmSelectedImage.alt;
selAlignment.value = elmSelectedImage.align;
}
}
}
setOKState(false);
txtFileName.focus();
}
function testTextValue(txtBox)
{
var val = parseInt(txtBox.value);
if (isNaN(val) || val < 0 || val > 999)
{
return false;
}
return true;
}
function btnOKClick()
{
var elmImage;
var intAlignment;
var L_HorizontalNotNumber_ErrorMessage
= "Horizontal spacing must be a number between 0 and 999.";
var L_VerticalNotNumber_ErrorMessage
= "Vertical spacing must be a number between 0 and 999.";
var L_BoderNotNumber_ErrorMessage
= "Border thickness must be a number between 0 and 999.";
var cmdInsertImage = "InsertImage";
var cmdDelete = "Delete";
var htmlSelectionControl = "Control";
var globalDoc = window.dialogArguments;
var grngMaster = globalDoc.selection.createRange();
if ("" != txtHorizontal.value)
{
if (!testTextValue(txtHorizontal))
{
alert(L_HorizontalNotNumber_ErrorMessage);
txtHorizontal.focus();
return;
}
}
if ("" != txtBorder.value)
{
if (!testTextValue(txtBorder))
{
alert(L_BoderNotNumber_ErrorMessage);
txtBorder.focus();
return;
}
}
if ("" != txtVertical.value)
{
if (!testTextValue(txtVertical))
{
alert(L_VerticalNotNumber_ErrorMessage);
txtVertical.focus();
return;
}
}
if (globalDoc.selection.type == htmlSelectionControl
&& !txtFileName.fImageLoaded)
{
grngMaster.execCommand(cmdDelete);
grngMaster = globalDoc.selection.createRange();
}
idstr = "\" id=\"c2eec6217e1a474eb649bfedd577334a";
if (!txtFileName.fImageLoaded)
{
grngMaster.execCommand(cmdInsertImage, false, idstr);
elmImage = globalDoc.all.c2eec6217e1a474eb649bfedd577334a;
elmImage.removeAttribute("id");
elmImage.removeAttribute("src");
grngMaster.moveStart("character", -1);
}
else
{
elmImage = grngMaster.item(0);
if (elmImage.src != txtFileName.value)
{
grngMaster.execCommand(cmdDelete);
grngMaster = globalDoc.selection.createRange();
grngMaster.execCommand(cmdInsertImage, false, idstr);
elmImage = globalDoc.all.c2eec6217e1a474eb649bfedd577334a;
elmImage.removeAttribute("id");
elmImage.removeAttribute("src");
grngMaster.moveStart("character", -1);
txtFileName.fImageLoaded = false;
}
grngMaster = getTextRange(elmImage);
}
if (txtFileName.fImageLoaded)
{
elmImage.style.width = txtFileName.intImageWidth;
elmImage.style.height = txtFileName.intImageHeight;
}
if (txtFileName.value.length > 2040)
txtFileName.value = txtFileName.value.substring(0,2040);
if ("" == getProtocolFromURL(txtFileName.value))
{
elmImage.src = "file://" + txtFileName.value;
}
else
{
elmImage.src = txtFileName.value;
}
if (txtHorizontal.value != "")
{
elmImage.hspace = parseInt(txtHorizontal.value);
}
else
{
elmImage.hspace = 0;
}
if (txtVertical.value != "")
{
elmImage.vspace = parseInt(txtVertical.value);
}
else
{
elmImage.vspace = 0;
}
elmImage.alt = txtAltText.value;
if (txtBorder.value != "")
{
elmImage.border = parseInt(txtBorder.value);
}
else
{
elmImage.border = 0;
}
elmImage.align = selAlignment.value;
grngMaster.collapse(false);
grngMaster.select();
window.close();
}
</SCRIPT>
</HEAD>
<BODY id=bdy onload="bdyLoad()" style="font-family: MS Shell Dlg;
font-size: 8pt; background: threedface; color: windowtext;" scroll=no>
<OBJECT ID="dialogHelper" CLASSID="CLSID:3050f4e1-98b5-11cf-bb82-00aa00bdce0b"
HEIGHT=0 WIDTH=0 tabindex=-1>
</OBJECT>
<DIV id=divFileName style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 0.98em; top: 1.2168em; width: 7em; height: 1.2168em; ">
<LABEL id=lblFileName FOR=txtFileName tabIndex=-1
helpid="35450" helpfile=msoe.hlp>
<U>P</U>icture Source:
</LABEL>
</DIV>
<INPUT ID=txtFileName type=text style="font-family: MS Shell Dlg; font-size: 8pt;
position: absolute; left: 8.54em; top: 1.0647em; width: 13.58em;
height: 2.1294em; " tabIndex=10 ACCESSKEY=p
helpid="35450" helpfile=msoe.hlp>
<DIV id=divAltText style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 0.98em; top: 4.1067em; width: 6.58em; height: 1.2168em; ">
<LABEL id=lblAltText FOR=txtAltText tabIndex=-1
helpid="35455" helpfile=msoe.hlp>
Alternate <u>T</u>ext:
</LABEL>
</DIV>
<INPUT type=text ID=txtAltText tabIndex=15 ACCESSKEY=t
style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 8.54em; top: 3.8025em; width: 21.5em; height: 2.1294em; "
helpid="35455" helpfile=msoe.hlp>
<BUTTON ID=btnBrowse style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 22.96em; top: 1.0647em; width: 7em; height: 2.2em; "
ACCESSKEY=r tabIndex=12 helpid="35462" helpfile=msoe.hlp>
B<U>r</U>owse...
</BUTTON>
<FIELDSET id=fldLayout style="font-family: MS Shell Dlg; font-size: 8pt;
position: absolute; left: .9em; top: 7.1em; width: 17.08em;
height: 7.6em;">
<LEGEND id=lgdLayout>
Layout
</LEGEND>
</FIELDSET>
<FIELDSET id=fldSpacing style="font-family: MS Shell Dlg; font-size: 8pt;
position: absolute; left: 18.9em; top: 7.1em; width: 11em;
height: 7.6em;">
<LEGEND id=lgdSpacing>
Spacing
</LEGEND>
</FIELDSET>
<DIV id=divAlign style="font-family: MS Shell Dlg; font-size: 8pt;
position: absolute; left: 1.82em; top: 9.126em; width: 4.76em;
height: 1.2168em; ">
<LABEL id=lblAlignment FOR=selAlignment tabIndex=-1 helpid="35465"
helpfile=msoe.hlp>
<U>A</U>lignment:
</LABEL>
</DIV>
<SELECT size=1 ID=selAlignment tabIndex=20 ACCESSKEY=a
style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 10.36em; top: 8.8218em; width: 6.72em; height: 1.2168em; "
helpid="35465" helpfile=msoe.hlp>
<OPTION id=optNotSet value=""> Not set </OPTION>
<OPTION id=optLeft value=left> Left </OPTION>
<OPTION id=optRight value=right> Right </OPTION>
<OPTION id=optTexttop value=textTop> Texttop </OPTION>
<OPTION id=optAbsMiddle value=absMiddle> Absmiddle </OPTION>
<OPTION id=optBaseline value=baseline SELECTED> Baseline </OPTION>
<OPTION id=optAbsBottom value=absBottom> Absbottom </OPTION>
<OPTION id=optBottom value=bottom> Bottom </OPTION>
<OPTION id=optMiddle value=middle> Middle </OPTION>
<OPTION id=optTop value=top> Top </OPTION>
</SELECT>
<DIV id=divHoriz style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 19.88em; top: 9.126em; width: 4.76em; height: 1.2168em; ">
<LABEL id=lblHorizontal FOR=txtHorizontal tabIndex=-1 helpid="35475"
helpfile=msoe.hlp>
<U>H</U>orizontal:
</LABEL>
</DIV>
<INPUT ID=txtHorizontal style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 24.92em; top: 8.8218em; width: 4.2em; height: 2.1294em; ime-mode: disabled;"
type=text size=3 value="" tabIndex=25 ACCESSKEY=h
helpid="35475" helpfile=msoe.hlp>
<DIV id=divBorder style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 1.82em; top: 12.0159em; width: 8.12em; height: 1.2168em; ">
<LABEL id=lblBorder tabIndex=-1 FOR=txtBorder helpid="35470"
helpfile=msoe.hlp>
<u>B</u>order Thickness:
</LABEL>
</DIV>
<INPUT ID=txtBorder style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 10.36em; top: 11.5596em; width: 6.72em; height: 2.1294em; ime-mode: disabled;"
type=text size=3 value="" tabIndex=21 ACCESSKEY=b
helpid="35470" helpfile=msoe.hlp>
<DIV id=divVert style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 19.88em; top: 12.0159em; width: 3.64em; height: 1.2168em; ">
<LABEL id=lblVertical FOR=txtVertical tabIndex=-1 helpid="35480"
helpfile=msoe.hlp>
<U>V</U>ertical:
</LABEL>
</DIV>
<INPUT ID=txtVertical style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 24.92em; top: 11.5596em; width: 4.2em; height: 2.1294em; ime-mode: disabled;"
type=text size=3 value="" tabIndex=30 ACCESSKEY=v
helpid="35480" helpfile=msoe.hlp>
<BUTTON ID=btnOK style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 31.36em; top: 1.0647em; width: 7em; height: 2.2em; " type=submit
tabIndex=40 DISABLED=1 helpid="28443" helpfile="windows.hlp">
OK
</BUTTON>
<BUTTON ID=btnCancel style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
left: 31.36em; top: 3.6504em; width: 7em; height: 2.2em; " type=reset
tabIndex=45 helpid="28444" helpfile="windows.hlp">
Cancel
</BUTTON>
</BODY>
</HTML>