|
From: creedon <icr...@us...> - 2005-10-18 16:26:29
|
Update of /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/html/data/standardMacros In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25133 Modified Files: imageRef Log Message: towards more modern standards such as XHTML v1.1 Index: imageRef =================================================================== RCS file: /cvsroot/frontierkernel/odbs/frontierRoot/system/verbs/builtins/html/data/standardMacros/imageRef,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** imageRef 26 Mar 2005 19:43:03 -0000 1.1.1.1 --- imageRef 18 Oct 2005 16:26:19 -0000 1.2 *************** *** 1,3 **** FrontierVcsFile:1:scpt:system.verbs.builtins.html.data.standardMacros.imageRef ! on imageRef (imagespec, explanation=nil, hspace="", align="", usemap="", ismap=false, border=0, pageTable=nil, glossref="", vspace="", lowsrc="", rollsrc="", height="", width="", name="", id="", style="", class="", title="") { ÇChange Notes: Ç5.0 changes DW Ç11/15/97 at 5:59:03 AM by DW Çdoesn't run off html.data.page, instead it assumes that xxx has been set up. Çtakes pagetable as an optional param, facilitates debugging, allows calling from outside of html suite. Çsupport for glossary references Ç5.0 changes PBS ÇThursday, January 01, 1998 at 12:52:02 PM by PBS ÇAdded vspace, lowscr, and rollsrc parameters. ÇThe rollsrc parameter specifies the image to display during Çan on mouseover event. ÇMade Frontier smarter about writing out changed images. ÇWednesday, January 07, 1998 at 4:24:37 PM by PBS ÇRemoved timeModified check. ÇAdded "name" parameter. ÇSunday, January 18, 1998 at 4:06:39 PM by PBS ÇCall html.getImagePath, a new script which builds relative URLs for images. Ç6.0 changes ÇFri, Feb 19, 1999 at 11:55:48 AM by PBS ÇAdded title parameter. Ç6.2.1 changes Ç07/05/00; 5:55:33 PM by PBS ÇCreate a default alt attribute if explanation is nil or "". HTML standards require alt attributes for all images. ÇPut quotes around the values for all attributes. local (htmlText = ""); local (imageTable, heightWidthString = ""); if pageTable == nil { pageTable = html.getPageTableAddress ()}; on add (s) { htmlText = htmlText + s}; ÇGet image data: url, path, address, mac file type, height, and width. imageTable = html.getImageData (imageSpec, pageTable); bundle { //get height and width of image; build heightWidthString if height == "" { height = imageTable.height}; if width == "" { width = imageTable.width}; if height != 0 { //we may have failed to get image size heightWidthString = "height=\"" + height + "\" "}; if width != 0 { heightWidthString = heightWidthString + "width=\"" + width + "\""}}; bundle { //build html text if name == "" { //optional name parameter add ("<img src=\"" + imageTable.url + "\" " + heightWidthString)} else { add ("<img name=\"" + name + "\" src=\"" + imageTable.url + "\" " + heightWidthString)}; if id != "" { add (" id=\"" + id + "\"")}; if lowsrc != "" { local (lowSrcData = html.getImageData (lowsrc, pageTable)); add (" lowsrc=\"" + lowSrcData.url + "\"")}; if explanation == nil { explanation = nameOf (imageTable.adrImage^) + " picture"}; if hspace != "" { add (" hspace=\"" + hspace + "\"")}; if vspace != "" { add (" vspace=\"" + vspace + "\"")}; if align != "" { add (" align=\"" + align + "\"")}; if usemap != "" { add (" usemap=\"#" + usemap + "\"")}; if ismap { add (" ismap")}; if rollsrc != "" { local (rollData = html.getImageData (rollsrc, pageTable)); add (" onmouseout=\"this.src='" + imageTable.url + "'\""); add (" onmouseover=\"this.src='" + rollData.url + "'\"")}; if style != "" { add (" style=\"" + style + "\"")}; if class != "" { add (" class=\"" + class + "\"")}; if title != "" { add (" title=\"" + title + "\"")}; add (" alt=\"" + explanation + "\""); //PBS 07/05/00: always add the alt attribute, as it's required by the HTML spec add (" border=\"" + border + "\""); ÇWed, Dec 25, 1996 at 7:33:16 AM by DW add (">")}; if glossref != "" { //5.0 enclose the imageref in an anchor or glosspatch local (s = html.refGlossary (glossref)); Çassume we have a hard-coded link or a glosspatch Ç<a href="http://www.scripting.com/frontier/">Frontier</a> or Ç[[#glossPatch Welcome to Alpha User's Test Page!|websitessamples/randomStuff|]] if s beginsWith "[[#" { local (ix = string.patternMatch (' ', s)); s = string.delete (s, 1, ix); s = string.nthField (s, '|', 2); Çthis is the part we keep htmltext = "[[#glossPatch " + htmltext + "|" + s + "|]]"} else { Çassume it's an a href s = string.nthField (s, '>', 1) + ">"; Çpop off the <a href="xxx"> part htmltext = s + htmltext + "</a>"}}; return (htmltext)} \ No newline at end of file --- 1,3 ---- FrontierVcsFile:1:scpt:system.verbs.builtins.html.data.standardMacros.imageRef ! on imageRef (imagespec, explanation=nil, hspace="", align="", usemap="", ismap=false, border=0, pageTable=nil, glossref="", vspace="", lowsrc="", rollsrc="", height="", width="", name="", id="", style="", class="", title="") { ÇChanges Ç10/17/05; 11:34:53 AM by TAC Çclose img tag, minor script formatting changes Ç07/05/00; 5:55:33 PM by PBS ÇCreate a default alt attribute if explanation is nil or "". HTML standards require alt attributes for all images. ÇPut quotes around the values for all attributes. ÇFri, Feb 19, 1999 at 11:55:48 AM by PBS ÇAdded title parameter. ÇSunday, January 18, 1998 at 4:06:39 PM by PBS ÇCall html.getImagePath, a new script which builds relative URLs for images. ÇWednesday, January 07, 1998 at 4:24:37 PM by PBS ÇRemoved timeModified check. ÇAdded "name" parameter. ÇThursday, January 01, 1998 at 12:52:02 PM by PBS ÇAdded vspace, lowscr, and rollsrc parameters. ÇThe rollsrc parameter specifies the image to display during Çan on mouseover event. ÇMade Frontier smarter about writing out changed images. Ç11/15/97 at 5:59:03 AM by DW Çdoesn't run off html.data.page, instead it assumes that xxx has been set up. Çtakes pagetable as an optional param, facilitates debugging, allows calling from outside of html suite. Çsupport for glossary references local (htmlText = ""); local (imageTable, heightWidthString = ""); if pageTable == nil { pageTable = html.getPageTableAddress ()}; on add (s) { htmlText = htmlText + s}; ÇGet image data: url, path, address, mac file type, height, and width. imageTable = html.getImageData (imageSpec, pageTable); bundle { // get height and width of image; build heightWidthString if height == "" { height = imageTable.height}; if width == "" { width = imageTable.width}; if height != 0 { // we may have failed to get image size heightWidthString = "height=\"" + height + "\" "}; if width != 0 { heightWidthString = heightWidthString + "width=\"" + width + "\""}}; bundle { // build html text if name == "" { // optional name parameter add ("<img src=\"" + imageTable.url + "\" " + heightWidthString)} else { add ("<img name=\"" + name + "\" src=\"" + imageTable.url + "\" " + heightWidthString)}; if id != "" { add (" id=\"" + id + "\"")}; if lowsrc != "" { local (lowSrcData = html.getImageData (lowsrc, pageTable)); add (" lowsrc=\"" + lowSrcData.url + "\"")}; if explanation == nil { explanation = nameOf (imageTable.adrImage^) + " picture"}; if hspace != "" { add (" hspace=\"" + hspace + "\"")}; if vspace != "" { add (" vspace=\"" + vspace + "\"")}; if align != "" { add (" align=\"" + align + "\"")}; if usemap != "" { add (" usemap=\"#" + usemap + "\"")}; if ismap { add (" ismap")}; if rollsrc != "" { local (rollData = html.getImageData (rollsrc, pageTable)); add (" onmouseout=\"this.src='" + imageTable.url + "'\""); add (" onmouseover=\"this.src='" + rollData.url + "'\"")}; if style != "" { add (" style=\"" + style + "\"")}; if class != "" { add (" class=\"" + class + "\"")}; if title != "" { add (" title=\"" + title + "\"")}; add (" alt=\"" + explanation + "\""); // PBS 07/05/00: always add the alt attribute, as it's required by the HTML spec add (" border=\"" + border + "\""); // Wed, Dec 25, 1996 at 7:33:16 AM by DW add ("/>")}; if glossref != "" { // 5.0 enclose the imageref in an anchor or glosspatch local (s = html.refGlossary (glossref)); Çassume we have a hard-coded link or a glosspatch Ç<a href="http:// www.scripting.com/frontier/">Frontier</a> or Ç[[#glossPatch Welcome to Alpha User's Test Page!|websitessamples/randomStuff|]] if s beginsWith "[[#" { local (ix = string.patternMatch (' ', s)); s = string.delete (s, 1, ix); s = string.nthField (s, '|', 2); // this is the part we keep htmlText = "[[#glossPatch " + htmlText + "|" + s + "|]]"} else { // assume it's an a href s = string.nthField (s, '>', 1) + ">"; // pop off the <a href="xxx"> part htmlText = s + htmlText + "</a>"}}; return (htmlText)} \ No newline at end of file |