alert('error= ' + code + '\nMessage=' + msg + '\n\n' + text);\r
}\r
\r
-\r
var cur = null;\r
\r
function doRequest(url, tgt){\r
}\r
\r
function unhilite(){\r
+ // move outline box back to current item\r
if(cur){\r
hilite(cur);\r
}\r
</script>\r
\r
</head>\r
- <body onload='javascript:iwfClickLink("mnuOverview");hilite("mnuOverview");'>\r
+ <body onload=''>\r
\r
<!-- logo -->\r
- <div id='logo'>\r
+ <div>\r
<h1>IWF - Interactive Website Framework</h1>\r
</div>\r
\r
- <div id='mnuBlock' class='menuBlock'>\r
- </div>\r
-\r
+ <!-- for menu animations -->\r
+ <div id='mnuBlock' class='menuBlock'></div>\r
<div id='mnuBlock2' class='menuBlock2'></div>\r
<div id='mnuBlock3' class='menuBlock2'></div>\r
\r
+\r
<!-- menu -->\r
<div id='menu' class='menu'>\r
<ul>\r
- <li><a href='javascript:doRequest("overview.xml", "mnuOverview");' onmouseover='javascript:hilite("mnuOverview");' onmouseout='javascript:unhilite();' id='mnuOverview'>Overview</a></li>\r
- <li><a href='javascript:doRequest("examples.xml", "mnuExamples");' onmouseover='javascript:hilite("mnuExamples");' onmouseout='javascript:unhilite();' id='mnuExamples'>Examples</a></li>\r
- <li><a href='javascript:doRequest("faq.xml", "mnuFaq");' onmouseover='javascript:hilite("mnuFaq");' onmouseout='javascript:unhilite();' id='mnuFaq'>FAQ</a></li>\r
- <li><a href='javascript:doRequest("download.xml", "mnuDownload");' onmouseover='javascript:hilite("mnuDownload");' onmouseout='javascript:unhilite();' id='mnuDownload'>Dowload</a></li>\r
+ <li><a\r
+ href='javascript:doRequest("overview.xml", "mnuOverview");'\r
+ onmouseover='javascript:hilite("mnuOverview");'\r
+ onmouseout='javascript:unhilite();'\r
+ id='mnuOverview'>Overview</a></li>\r
+ <li><a\r
+ href='javascript:doRequest("examples.xml", "mnuExamples");'\r
+ onmouseover='javascript:hilite("mnuExamples");'\r
+ onmouseout='javascript:unhilite();'\r
+ id='mnuExamples'>Examples</a></li>\r
+ <li><a\r
+ href='javascript:doRequest("faq.xml", "mnuFaq");'\r
+ onmouseover='javascript:hilite("mnuFaq");'\r
+ onmouseout='javascript:unhilite();'\r
+ id='mnuFaq'>FAQ</a></li>\r
+ <li><a\r
+ href='javascript:doRequest("download.xml", "mnuDownload");'\r
+ onmouseover='javascript:hilite("mnuDownload");'\r
+ onmouseout='javascript:unhilite();'\r
+ id='mnuDownload'>Download</a></li>\r
</ul>\r
</div>\r
\r
- <!-- bread crumb -->\r
- <div id='breadcrumb' />\r
+ <!-- prepackaged window\r
+ <div id='exampleWindow' iwfWindow='true' iwfWindowTitle='Content' style='width:400;height:300;top:200px;left:150px;border:1px solid black;'>\r
+ </div>\r
+ -->\r
+\r
+ <!-- default target for IWF -->\r
+ <div id='iwfContent' style='background-color:white;padding:5px 5px 5px 5px'></div>\r
\r
- <!-- main content -->\r
- <div id='iwfContent' class='content' />\r
\r
- <!-- footer -->\r
- <div id='footer'>\r
+ <!-- stuff at the bottom -->\r
+ <div class='sidebar'>\r
+ <p> </p>\r
+\r
+ <!-- source forge links -->\r
+<a href="http://sourceforge.net"> <img src="http://sourceforge.net/sflogo.php?group_id=140835&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></a>\r
+<a href="http://sourceforge.net/donate/index.php?group_id=140835"><img src="http://images.sourceforge.net/images/project-support.jpg" width="88" height="32" border="0" alt="Support IWF" /></a>\r
+\r
</div>\r
\r
+ <script type='text/javascript' src='../iwfconfig.js'></script>\r
+\r
+ <script type='text/javascript'>\r
+ // the source forge images sometimes take too long to come up,\r
+ // so click the link and hilite the current menu item before the body onload event fires...\r
+ iwfClickLink("mnuOverview");\r
+ hilite("mnuOverview");\r
+ </script>\r
</body>\r
</html>
\ No newline at end of file
body {\r
color:black;\r
}\r
+\r
+h1 {\r
+ font-size:28px;\r
+}\r
+\r
+h2 {\r
+ font-size:24px;\r
+ padding: 15px 3px 3px 3px;\r
+}\r
+\r
+h3 {\r
+ font-size:20px;\r
+ background-color:navy;\r
+ color: white;\r
+ padding: 3px 3px 3px 3px;\r
+}\r
+\r
+h4 {\r
+ font-size:16px;\r
+}\r
+\r
+pre {\r
+ padding-top: 5px;\r
+ border-top: 1px solid grey;\r
+ padding-left: 5px;\r
+ border-left: 1px solid grey;\r
+ padding-bottom: 5px;\r
+ border-bottom: 1px solid grey;\r
+}\r
+\r
.menu\r
{\r
text-align:left;\r
padding:2px 10px 2px 10px;\r
width:120px;\r
text-align:center;\r
- text-decoration: none;\r
+ text-decoration:none;\r
cursor: hand;\r
color:navy;\r
float:left;\r
font-weight:bold;\r
}\r
\r
-.menu a:active {\r
- color:red;\r
-}\r
-\r
.menu a:link, .menu a:active, .menu a:visited {\r
- color:navy;\r
}\r
\r
.menu a:hover {\r
font-weight:bold;\r
text-decoration:none;\r
background-color:white;\r
- color:black;\r
}\r
\r
.menuBlock {\r
position:absolute;\r
border:1px solid grey;\r
width:100px;\r
- left:10px;\r
- top:105px;\r
+ left:-200px;\r
+ top:85px;\r
height:24px;\r
opacity:0.25;\r
filter:alpha(opacity:25);\r
.menuBlock2 {\r
position:absolute;\r
background-color:lightgrey;\r
+ overflow:hidden;\r
width:50px;\r
- left:10px;\r
- top:105px;\r
+ left:-200px;\r
+ top:85px;\r
height:10px;\r
- opacity:0.75;\r
- filter:alpha(opacity:75);\r
+}\r
+\r
+.sidebar {\r
+ text-align:center;\r
}\r
\r
.content {\r
- width:500px; \r
- left:50px;\r
- padding:15px 5px 5px 5px;\r
- margin-top:5px;\r
-/* border-top:2px solid lightgrey; */\r
+ width:400px; \r
+ height:200px;\r
+ overflow:scroll;\r
+ padding:5px 5px 5px 5px;\r
}
\ No newline at end of file
Most of what IWF does is fairly basic, so most other major browsers should work fine. If not, <a href='mailto:brockweaver@sourceforge.net'>drop me a line</a> and I'll see if I can get it working.\r
<pre>\r
<plug type='shameless'>\r
- If you want me to start supporting Safari, <a href='donate.php'>donate to my iMac fund</a>!\r
+ If you want IWF to start supporting Safari, \r
+ <a href='http://sourceforge.net/donate/index.php?group_id=140835'>donate to IWF</a>!\r
</plug>\r
</pre>\r
</p>\r
IWF-copmliant xml from a PHP server. This could very easily be ported to ASP, but since the release\r
of ASP.NET, my focus has shifted away from it.\r
</p>\r
- <p>\r
- \r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
- <p>\r
- </p>\r
</action>\r
</response>
\ No newline at end of file
-// -----------------------------------------------------------------------------\r
-// IWF - Interactive Website Framework. Javascript library for creating\r
-// responsive thin client interfaces.\r
-//\r
-// Copyright (C) 2005 Brock Weaver brockweaver@gmail.com\r
-//\r
-// This library is free software; you can redistribute it and/or modify\r
-// it under the terms of the GNU Lesser General Public License as published\r
-// by the Free Software Foundation; either version 2.1 of the License, or\r
-// (at your option) any later version.\r
-//\r
-// This library is distributed in the hope that it will be useful, but\r
-// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
-// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
-// License for more details.\r
+// =========================================================================\r
+/// IWF - Interactive Website Framework. Javascript library for creating\r
+/// responsive thin client interfaces.\r
+///\r
+/// Copyright (C) 2005 Brock Weaver brockweaver@users.sourceforge.net\r
+///\r
+/// This library is free software; you can redistribute it and/or modify\r
+/// it under the terms of the GNU Lesser General Public License as published\r
+/// by the Free Software Foundation; either version 2.1 of the License, or\r
+/// (at your option) any later version.\r
+///\r
+/// This library is distributed in the hope that it will be useful, but\r
+/// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+/// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
+/// License for more details.\r
+///\r
+/// You should have received a copy of the GNU Lesser General Public License\r
+/// along with this library; if not, write to the Free Software Foundation,\r
+/// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+///\r
+/// Brock Weaver\r
+/// brockweaver@users.sourceforge.net\r
+/// 1605 NW Maple Pl\r
+/// Ankeny, IA 50021\r
+///\r
+//! http://iwf.sourceforge.net/\r
+// --------------------------------------------------------------------------\r
+//! NOTE: To minimize file size, strip all fluffy comments (except the LGPL, of course!)\r
+//! using the following regex (global flag and multiline on):\r
+//! ^\t*//([^/!].*|$)\r
//\r
-// You should have received a copy of the GNU Lesser General Public License\r
-// along with this library; if not, write to the Free Software Foundation,\r
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+// This reduces file size by about 30%, give or take.\r
//\r
-// Brock Weaver\r
-// brockweaver@gmail.com\r
-// 1605 NW Maple Pl\r
-// Ankeny, IA 50021\r
-// -----------------------------------------------------------------------------\r
+//! To rip out only logging statements (commented or uncommented):\r
+//! ^/{0,2}iwfLog.*\r
+// --------------------------------------------------------------------------\r
+\r
\r
// --------------------------------------------------------------------------\r
-// iwfajax.js\r
+//\r
+//! iwfajax.js\r
//\r
// Thread-safe background xml request via XmlHttpRequest object\r
//\r
-// Dependencies:\r
-// iwfxml.js\r
-// iwfcore.js\r
-// iwfgui.js (optional -- pretty progress bar)\r
+//! Dependencies:\r
+//! iwfxml.js\r
+//! iwfcore.js\r
+//! iwfgui.js (optional -- pretty progress bar)\r
//\r
-// Brock Weaver - brockweaver@sourceforge.net - iwf.sourceforge.net\r
-// v 0.1 - 2005-06-05\r
-// Initial release.\r
-// --------------------------------------------------------------------------\r
-// Known Issues:\r
-// AddToHistory does not work\r
-// Iframe not implemented\r
+//! Brock Weaver - brockweaver@users.sourceforge.net\r
+//! v 0.2 - 2005-11-14\r
+//! core bug patch\r
// --------------------------------------------------------------------------\r
+//! v 0.1 - 2005-06-05\r
+//! Initial release.\r
+//\r
+//! Known Issues:\r
+//! AddToHistory does not work\r
+//! Iframe not implemented\r
+//\r
+// =========================================================================\r
+\r
+\r
+\r
+\r
+// show progress bar if they included iwfgui.js, window.status otherwise.\r
+var _iwfShowGuiProgress = iwfExists(window.iwfShow);\r
+\r
+\r
+\r
+\r
+\r
+\r
+// -----------------------------------\r
+// Begin: Dependency Check\r
+// -----------------------------------\r
\r
if (!window.iwfGetById || !window.iwfXmlDoc){\r
iwfLog("IWF Dependency Error: iwfajax.js is dependent upon both iwfcore.js and iwfxml.js, so you *must* reference those files first.\n\nExample:\n\n<script type='text/javascript' src='iwfcore.js'></script>\n<script type='text/javascript' src='iwfxml.js'></script>\n<script type='text/javascript' src='iwfajax.js'></script>", true);\r
}\r
\r
+// -----------------------------------\r
+// End: Dependency Check\r
+// -----------------------------------\r
+\r
// -----------------------------------\r
// Begin: AJAX Request and Response\r
// -----------------------------------\r
if (req.readyState == 4) {\r
_iwfOnRequestEnd();\r
if (req.status == 200 || req.status == 0) {\r
-iwfLog('exact response from server:\n\n' + req.responseText);\r
+//iwfLog('exact response from server:\n\n' + req.responseText);\r
_iwfResponseHandler(req.responseText, localCallback, localTarget);\r
} else {\r
_iwfOnRequestError(req.status, req.statusText, req.responseText);\r
}\r
\r
if (localTarget){\r
- var elTgt = iwfGetOrCreateWithinForm(urlOrForm, 'iwfTarget', 'input', 'hidden');\r
+ var elTgt = iwfGetOrCreateByNameWithinForm(urlOrForm, 'iwfTarget', 'input', 'hidden');\r
if (elTgt){\r
iwfAttribute(elTgt, 'value', localTarget);\r
iwfRemoveAttribute(elTgt, 'disabled');\r
// prevent any browser caching of our url by requesting a unique url everytime...\r
url += ((url.indexOf('?') > -1) ? '&' : '?') + 'iwfRequestId=' + new Date().valueOf();\r
\r
-iwfLog("url = " + url);\r
-iwfLog("method = " + method);\r
-iwfLog("postdata = " + postdata);\r
-iwfLog("contenttype = " + contentType);\r
+//iwfLog("url = " + url);\r
+//iwfLog("method = " + method);\r
+//iwfLog("postdata = " + postdata);\r
+//iwfLog("contenttype = " + contentType);\r
\r
\r
var req = null;\r
if (!addToHistory){\r
-iwfLog("using XHR to perform request...");\r
+//iwfLog("using XHR to perform request...");\r
// use XHR to perform the request, as this will\r
// prevent the browser from adding it to history.\r
req = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");\r
// if there is a target specified in the <form> tag,\r
// copy its contents to a hidden <input type='hidden'> tag.\r
\r
-iwfLog("total elements in form named '" + form.name + "': " + form.elements.length);\r
+//iwfLog("total elements in form named '" + form.name + "': " + form.elements.length);\r
for(var i=0;i<form.elements.length;i++){\r
var el = form.elements[i];\r
var nm = iwfAttribute(el, 'name');\r
switch(iwfAttribute(el, 'type')){\r
case 'checkbox':\r
case 'radio':\r
- if (iwfAttribute(el, 'checked') || el.checked){\r
- val = iwfAttribute(el, 'value') || el.value;\r
+ if (iwfAttribute(el, 'checked')){\r
+ val = iwfAttribute(el, 'value');\r
}\r
break;\r
case 'button':\r
}\r
break;\r
case 'textarea':\r
- val = iwfAttribute(el, 'innerText') || el.value;\r
+ val = iwfAttribute(el, 'innerText');\r
break;\r
case 'button':\r
if (el == ctl){\r
- val = iwfAttribute(el, 'innerText') || el.value;\r
+ val = iwfAttribute(el, 'innerText');\r
}\r
break;\r
case 'select':\r
}\r
\r
function _iwfResponseReceived(doc){\r
- iwfLog('iframeloaded');\r
+iwfLog('iframeloaded');\r
var xmlDoc = new iwfXmlDoc(doc.innerHTML);\r
}\r
\r
for(var i=0; i< doc.response.childNodes.length; i++){\r
var node = doc.response.childNodes[i];\r
if (node.nodeName.indexOf("#") != 0){\r
-iwfLog('node.target=' + node.target + '\ntgt=' + tgt);\r
+//iwfLog('node.target=' + node.target + '\ntgt=' + tgt);\r
if (!tgt) {\r
// server target is ignored if a client target exists.\r
tgt = node.target;\r
\r
// this code is the worst hack in this entire framework.\r
// the code in the try portion should work anywhere -- but\r
- // ie barfs when you try to set the innerHTML on a script element.\r
- // not only that, but ie won't parse script unless a visible element\r
- // is contained in the innerHTML when it is set, so we need the <code>ie hack here</code>\r
+ // IE barfs when you try to set the innerHTML on a script element.\r
+ // not only that, but IE won't parse script unless a visible element\r
+ // is contained in the innerHTML when it is set, so we need the <code>IE hack here</code>\r
// and it cannot be removed.\r
// I don't understand why creating a new node and setting its innerHTML causes the browsers\r
// to parse and execute the script, but it does.\r
// Plus I'm getting lazy. :)\r
//\r
try {\r
- // moz (DOM)\r
- var elScript = iwfGetOrCreateById('iwfScript' + i, 'script', 'body');\r
+ //! moz (DOM)\r
+ var elScript = iwfGetOrCreateById('iwfScript' + i, 'script');\r
elScript.type = 'text/javascript';\r
elScript.defer = 'true';\r
elScript.innerHTML = scriptHtml;\r
\r
+ iwfAppendChild('body', elScript);\r
+\r
} catch(e){\r
- // ie hack -- need a visible tag within a non-script element to have scripting apply... Don't ask me why, ask the IE team why...\r
+iwfLog("IE Hack for injecting script tag...", true);\r
+ //! IE hack\r
+ // IE needs a visible tag within a non-script element to have scripting apply... Don't ask me why, ask the IE team why.\r
+ // My guess is the visible element causes the page to at least partially re-render, which in turn kicks off any script parsing\r
+ // code in IE.\r
var elDiv = iwfGetOrCreateById('iwfScript' + i, '<div style="display:none"></div>', 'body');\r
- elDiv.innerHTML = '<code>ie hack here</code><script id="iwfScript' + i + '" defer="true">' + scriptHtml + '</script' + '>';\r
+ elDiv.innerHTML = '<code>IE hack here</code><script id="iwfScript' + i + '" defer="true">' + scriptHtml + '</script' + '>';\r
}\r
\r
i++;\r
\r
function iwfCleanScripts(){\r
var i = 0;\r
- while((el = iwfGetById('iwfScript' + i))){\r
- iwfRemoveNode(el);\r
- i++;\r
- }\r
+ while(iwfRemoveNode('iwfScript' + (i++)));\r
+\r
}\r
\r
\r
var _iwfRequestTicker = null;\r
var _iwfRequestTickCount = 0;\r
var _iwfRequestTickDuration = 100;\r
+\r
+\r
+// TODO: make the styles applied be configurable variables at the top of this file.\r
+function _iwfGetBusyBar(inner){\r
+ var b = iwfGetById('iwfBusy');\r
+ if (!b){\r
+ b = iwfGetOrCreateById('iwfBusy', 'div', 'body');\r
+ if(b.style){\r
+ b.style.position = 'absolute';\r
+ b.style.border = '1px solid black';\r
+ b.style.backgroundColor = '#efefef';\r
+ b.style.textAlign = 'center';\r
+ }\r
+ iwfWidth(b, 100);\r
+ iwfHeight(b, 20);\r
+ iwfZIndex(b, 9999);\r
+\r
+ iwfX(b, 0);\r
+ iwfY(b, 0);\r
+\r
+// iwfX(b, iwfClientWidth() - iwfWidth(b)-5);\r
+// iwfY(b, iwfClientHeight() - iwfHeight(b)-5);\r
+\r
+ iwfHide(b);\r
+ }\r
+\r
+\r
+\r
+ var bb = iwfGetById('iwfBusyBar');\r
+ if(!bb){\r
+ bb = iwfGetOrCreateById('iwfBusyBar', 'div', b);\r
+ bb.style.backgroundColor = 'navy';\r
+ bb.style.color = 'white';\r
+ bb.style.textAlign = 'center';\r
+ iwfWidth(bb, 1);\r
+ iwfHeight(bb, 20);\r
+ iwfX(bb, 0);\r
+ iwfY(bb, 0);\r
+ }\r
+\r
+ if(inner){\r
+ return bb;\r
+ } else {\r
+ return b;\r
+ }\r
+\r
+}\r
+\r
function _iwfOnRequestStart(){\r
_iwfPendingRequests++;\r
_iwfTotalRequests++;\r
_iwfRequestTickCount = 0;\r
if (window.iwfOnRequestStart){\r
_iwfRequestTickDuration = iwfOnRequestStart();\r
+ } else if (_iwfShowGuiProgress) {\r
+ // use gui busy implementation\r
+ var bb = _iwfGetBusyBar(true);\r
+ iwfWidth(bb, 1);\r
+ bb.innerHTML = '0%';\r
+ iwfShow(_iwfGetBusyBar(false));\r
} else {\r
// use default busy implementation...\r
- // TODO: make this better!\r
window.status = 'busy.';\r
}\r
if (!_iwfRequestTickDuration){\r
if (window.iwfOnRequestTick){\r
iwfOnRequestTick(_iwfRequestTickCount, _iwfRequestTickDuration, _iwfPendingRequests);\r
} else if (!window.iwfOnRequestStart) {\r
- // use default busy implementation...\r
- // TODO: make this better!\r
- window.status = 'busy...............................................'.substr(0, (_iwfRequestTickCount % 45) + 5);\r
+ if (_iwfShowGuiProgress) {\r
+ // use gui busy implementation\r
+ var bar = _iwfGetBusyBar(true);\r
+ if(bar){\r
+ var w = iwfWidth(bar) + 1;\r
+ if (w > 95){\r
+ w = 95;\r
+ }\r
+ iwfWidth(bar, w);\r
+ bar.innerHTML = "loading " + iwfIntFormat(w) + "%";\r
+ }\r
+ } else {\r
+ // use default busy implementation...\r
+ window.status = 'busy...............................................'.substr(0, (_iwfRequestTickCount % 45) + 5);\r
+ }\r
} else {\r
// they didn't define a tick function,\r
// but they did define a start one, so do nothing.\r
if (window.iwfOnRequestEnd){\r
iwfOnRequestEnd();\r
} else if (!window.iwfOnRequestStart) {\r
- // use default busy implementation...\r
- // TODO: make this better!\r
- window.status = 'done.';\r
+ if (_iwfShowGuiProgress) {\r
+ // use gui busy implementation\r
+ var bar = _iwfGetBusyBar(true);\r
+ if(bar){\r
+ iwfWidth(bar, 100);\r
+ bar.innerHTML = "Done";\r
+ iwfHideGentlyDelay(_iwfGetBusyBar(false), 15, 500);\r
+ }\r
+ } else {\r
+ // use default busy implementation...\r
+ window.status = 'done.';\r
+ }\r
} else {\r
// they didn't define an end function,\r
// but they did define a start one, so do nothing.\r
if (window.iwfOnRequestProgress){\r
iwfOnRequestProgress(_iwfPendingRequests, _iwfTotalRequests);\r
} else if (!window.iwfOnRequestStart) {\r
- // use default busy implementation...\r
- // TODO: make this better!\r
- window.status = 'Remaining: ' + _iwfPendingRequests;\r
+ if (_iwfShowGuiProgress) {\r
+ // use gui busy implementation\r
+ var pct = (1 - (_iwfPendingRequests/_iwfTotalRequests)) * 100;\r
+ if (pct > 100){\r
+ pct = 100;\r
+ }\r
+ var bar = _iwfGetBusyBar(true);\r
+ if(bar){\r
+ iwfWidth(bar, pct);\r
+ bar.innerHTML = "loading " + iwfIntFormat(pct) + "%";\r
+ }\r
+ } else {\r
+ // use default busy implementation...\r
+ window.status = 'Remaining: ' + _iwfRequestsPending;\r
+ }\r
} else {\r
// they didn't define an end function,\r
// but they did define a start one, so do nothing.\r
--- /dev/null
+// --------------------------------------------------------------------------\r
+/// IWF - Interactive Website Framework. Javascript library for creating\r
+/// responsive thin client interfaces.\r
+///\r
+/// Copyright (C) 2005 Brock Weaver brockweaver@users.sourceforge.net\r
+///\r
+/// This library is free software; you can redistribute it and/or modify\r
+/// it under the terms of the GNU Lesser General Public License as published\r
+/// by the Free Software Foundation; either version 2.1 of the License, or\r
+/// (at your option) any later version.\r
+///\r
+/// This library is distributed in the hope that it will be useful, but\r
+/// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+/// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
+/// License for more details.\r
+///\r
+/// You should have received a copy of the GNU Lesser General Public License\r
+/// along with this library; if not, write to the Free Software Foundation,\r
+/// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+///\r
+/// Brock Weaver\r
+/// brockweaver@users.sourceforge.net\r
+/// 1605 NW Maple Pl\r
+/// Ankeny, IA 50021\r
+///\r
+//! http://iwf.sourceforge.net/\r
+// --------------------------------------------------------------------------\r
+//! NOTE: To minimize file size, strip all fluffy comments (except the LGPL, of course!)\r
+//! using the following regex (global flag and multiline on):\r
+//! ^\t*//([^/!].*|$)\r
+//\r
+// This reduces file size by about 30%, give or take.\r
+//\r
+//! To rip out only logging statements (commented or uncommented):\r
+//! ^/{0,2}iwfLog.*\r
+// --------------------------------------------------------------------------\r
+\r
+// --------------------------------------------------------------------------\r
+//! iwfconfig.js\r
+//\r
+// Variables a developer using IWF may wish to change to customize IWF for their app\r
+//\r
+//! Dependencies:\r
+//! (none)\r
+//\r
+//! Brock Weaver - brockweaver@users.sourceforge.net\r
+//! v 0.2 - 2005-11-14\r
+//! core bug patch\r
+// --------------------------------------------------------------------------\r
+//! v 0.1 - 2005-06-17\r
+//! Initial release.\r
+// --------------------------------------------------------------------------\r
+\r
+// -----------------------------------\r
+// Begin: Configurable variables, IWF-wide\r
+// -----------------------------------\r
+\r
+// All variables are shown with their default code!\r
+\r
+//! -- iwfcore.js\r
+//! set to true to enable logging. Logging simply means certain values are appended to a string. nothing is written out or communicated over the wire anywhere.\r
+_iwfLoggingEnabled = true;\r
+\r
+//! -- iwfgui.js\r
+//! (none)\r
+\r
+//! -- iwfxml.js\r
+//! (none)\r
+\r
+//! -- iwfajax.js\r
+//! if this is hardcoded to true, iwfgui.js *must* be included in all pages that reference iwfajax.js as well.\r
+//! if false, the "busy bar" is not shown, and in its place the window.status is updated.\r
+_iwfShowGuiProgress = iwfExists(window.iwfShow); // && false;\r
+\r
+\r
+// -----------------------------------\r
+// End: Configurable variables, IWF-wide\r
+// -----------------------------------\r
+\r
+// -----------------------------------\r
+// Begin: Initializers\r
+// -----------------------------------\r
+//if (window.iwfMapRollovers){\r
+// iwfMapRollovers();\r
+//}\r
+\r
+//if (window.iwfMapDropTargets){\r
+// iwfMapDropTargets(document);\r
+//}\r
+\r
+if (window.iwfMapWindows){\r
+ iwfMapWindows(document.body);\r
+}\r
+\r
+if (window.iwfMapDraggables){\r
+ iwfMapDraggables(document.body);\r
+}\r
+// -----------------------------------\r
+// End: Initializers\r
+// -----------------------------------\r
-// -----------------------------------------------------------------------------\r
-// IWF - Interactive Website Framework. Javascript library for creating\r
-// responsive thin client interfaces.\r
+// =========================================================================\r
+/// IWF - Interactive Website Framework. Javascript library for creating\r
+/// responsive thin client interfaces.\r
+///\r
+/// Copyright (C) 2005 Brock Weaver brockweaver@users.sourceforge.net\r
+///\r
+/// This library is free software; you can redistribute it and/or modify\r
+/// it under the terms of the GNU Lesser General Public License as published\r
+/// by the Free Software Foundation; either version 2.1 of the License, or\r
+/// (at your option) any later version.\r
+///\r
+/// This library is distributed in the hope that it will be useful, but\r
+/// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+/// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
+/// License for more details.\r
+///\r
+/// You should have received a copy of the GNU Lesser General Public License\r
+/// along with this library; if not, write to the Free Software Foundation,\r
+/// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+///\r
+/// Brock Weaver\r
+/// brockweaver@users.sourceforge.net\r
+/// 1605 NW Maple Pl\r
+/// Ankeny, IA 50021\r
+///\r
+//! http://iwf.sourceforge.net/\r
+// =========================================================================\r
+//! NOTE: To minimize file size, strip all fluffy comments (except the LGPL, of course!)\r
+//! using the following regex (global flag and multiline on):\r
+//! ^\t*//([^/!].*|$)\r
//\r
-// Copyright (C) 2005 Brock Weaver brockweaver@gmail.com\r
+// This reduces file size by about 30%, give or take.\r
//\r
-// This library is free software; you can redistribute it and/or modify\r
-// it under the terms of the GNU Lesser General Public License as published\r
-// by the Free Software Foundation; either version 2.1 of the License, or\r
-// (at your option) any later version.\r
-//\r
-// This library is distributed in the hope that it will be useful, but\r
-// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
-// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
-// License for more details.\r
-//\r
-// You should have received a copy of the GNU Lesser General Public License\r
-// along with this library; if not, write to the Free Software Foundation,\r
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
-//\r
-// Brock Weaver\r
-// brockweaver@gmail.com\r
-// 1605 NW Maple Pl\r
-// Ankeny, IA 50021\r
-// -----------------------------------------------------------------------------\r
+//! To rip out only logging statements (commented or uncommented):\r
+//! ^/{0,2}iwfLog.*\r
+// =========================================================================\r
\r
// --------------------------------------------------------------------------\r
-// iwfcore.js\r
+//! iwfcore.js\r
//\r
// Core functions\r
//\r
-// Dependencies:\r
-// (none)\r
+//! Dependencies:\r
+//! (none)\r
//\r
-// Brock Weaver - brockweaver@sourceforge.net - iwf.sourceforge.net\r
-// v 0.1 - 2005-06-05\r
-// Initial release.\r
-// --------------------------------------------------------------------------\r
+//! Brock Weaver - brockweaver@users.sourceforge.net\r
+//! v 0.2 - 2005-11-14\r
+//! iwfcore bug patch\r
+//! --------------------------------------------------------------------------\r
+//! - fixed iwfAttribute to return most current value instead of initial value\r
+//!\r
+//! v 0.1 - 2005-06-05\r
+//! Initial release.\r
+//! --------------------------------------------------------------------------\r
\r
// -----------------------------------\r
// Begin: Configurable variables\r
// -----------------------------------\r
\r
// set to true to enable logging. Logging simply means certain values are appended to a string. nothing is written out or communicated over the wire anywhere.\r
-var iwfLoggingEnabled = true;\r
+var _iwfLoggingEnabled = true;\r
\r
\r
// -----------------------------------\r
return frm;\r
}\r
\r
-function iwfGetByIdWithinForm(form, id){\r
+function iwfGetByNameWithinForm(form, nm){\r
var frm = iwfGetForm(form);\r
if (!frm){\r
iwfLog("IWF Core Error: Could not locate form by id, document.forms, or document[] named '" + form + "'", true);\r
} else {\r
// find element within this form with given id.\r
var el = null;\r
- if (iwfIsString(id) || iwfIsNumber(id)) {\r
+ if (iwfIsString(nm) || iwfIsNumber(nm)) {\r
for(var i=0;i<frm.elements.length;i++){\r
- if (frm.elements[i].name == id || frm.elements[i].id == id){\r
+ if (frm.elements[i].name == nm || frm.elements[i].id == nm){\r
el = frm.elements[i];\r
break;\r
}\r
} else {\r
el = id;\r
}\r
-//iwfLog('iwfGetByIdWithinForm returning:\n\n' + iwfElementToString(el), true);\r
+//iwfLog('iwfGetByNameWithinForm returning:\n\n' + iwfElementToString(el), true);\r
return el;\r
}\r
}\r
\r
-function iwfGetOrCreateWithinForm(form, id, tagNameOrHtml, typeAtt){\r
+function iwfGetOrCreateByNameWithinForm(form, nm, tagNameOrHtml, typeAtt){\r
var elFrm = iwfGetForm(form);\r
\r
if (!elFrm){\r
return;\r
}\r
\r
- var el = iwfGetByIdWithinForm(form, id);\r
+ var el = iwfGetByNameWithinForm(form, nm);\r
if (!el){\r
// element does not exist. create it.\r
el = document.createElement(tagNameOrHtml);\r
- iwfAttribute(el, 'name', id);\r
+ iwfAttribute(el, 'name', nm);\r
\r
if (typeAtt){\r
iwfAttribute(el, 'type', typeAtt);\r
if (parentNodeId){\r
var elParent = iwfGetById(parentNodeId);\r
if (elParent){\r
- iwfAppendChild(elParent, el);\r
+ iwfAddChild(elParent, el);\r
} else if (parentNodeId.toLowerCase() == 'body'){\r
- iwfAppendChild(document.body, el);\r
+ iwfAddChild(document.body, el);\r
}\r
}\r
\r
return el;\r
}\r
\r
-function iwfAppendChild(parentNodeId, childNodeId){\r
+function iwfAddChild(parentNodeId, childNodeId, atFront){\r
\r
var elChild = iwfGetById(childNodeId);\r
if (!elChild) return null;\r
\r
\r
\r
- // append the element to the parent\r
- elParent.appendChild(elChild);\r
+ if (!atFront || !elParent.hasChildNodes()){\r
+ // append as last child of elParent\r
+ elParent.appendChild(elChild);\r
+ } else {\r
+ // append as first child of elParent\r
+ elParent.insertBefore(elChild, elParent.childNodes[0]);\r
+ }\r
\r
return elParent;\r
}\r
\r
function iwfRemoveNode(id){\r
var el = iwfGetById(id);\r
- if (!el) return;\r
+ if (!el) return false;\r
document.removeNode(el);\r
+ return true;\r
}\r
\r
function iwfElementToString(id){\r
if (el.attributes){\r
for(var i=0;i<el.attributes.length;i++){\r
var att = el.attributes[i];\r
- s += ' ' + att.nodeName + '=' + att.nodeValue + ' ';\r
+ s += ' ' + att.nodeName + '="' + att.nodeValue + '" ';\r
}\r
}\r
if (el.innerHTML == ''){\r
el.setAttribute(attName, newval);\r
}\r
}\r
- val = el.getAttribute(attName);\r
+ // 2005-11-14 Brock Weaver\r
+ // added check for attribute on el before trying getAttribute method\r
+ // (Thanks J.P. Jarolim!)\r
+ if (el[attName]){\r
+ val = el[attName];\r
+ } else if (el.getAttribute) {\r
+ val = el.getAttribute(attName);\r
+ }\r
return val;\r
}\r
\r
return ret;\r
}\r
// -----------------------------------\r
-// End: Xml Utility Functions\r
+// End: Encoding Utility Functions\r
// -----------------------------------\r
\r
\r
return false;\r
} else {\r
// determine if the month/day makes sense.\r
- var mo = parseInt(dt.substring(0,2), 10);\r
- var dy = parseInt(dt.substring(3,2), 10);\r
- var yr = parseInt(dt.substring(6,4), 10);\r
+ var mo = iwfToInt(dt.substring(0,2));\r
+ var dy = iwfToInt(dt.substring(3,2));\r
+ var yr = iwfToInt(dt.substring(6,4));\r
var maxdy = 28;\r
switch(mo){\r
case 4:\r
var arr = val.split(delim);\r
switch(arr.length){\r
case 2:\r
- // possibles: 9/2, 9/2004, 09/06,\r
- // assume first is always month\r
+ //! possibles: 9/2, 9/2004, 09/06,\r
+ //! assume first is always month\r
mo = '00' + arr[0];\r
if (arr[1].length == 4){\r
- // assume second is year.\r
+ //! assume second is year.\r
yr = arr[1];\r
} else {\r
- // assume second is date.\r
+ //! assume second is date.\r
dy = '00' + arr[1];\r
}\r
break;\r
case 3:\r
- // possibles: 9/2/1, 9/02/04, 09/02/2004, 9/2/2004\r
+ //! possibles: 9/2/1, 9/02/04, 09/02/2004, 9/2/2004\r
mo = '00' + arr[0];\r
dy = '00' + arr[1];\r
switch(arr[2].length){\r
}\r
break;\r
case 3:\r
- // 3 digits... assume 2000 I guess\r
+ //! 3 digits... assume 2000 I guess\r
yr = '2' + arr[2];\r
break;\r
case 4:\r
// Begin: Form Submittal Utility Functions\r
// -----------------------------------\r
function iwfDoAction(act, frm, id, targetElement){\r
-//alert('action=' + act + '\nfrm=' + frm + '\nid=' + id + '\ntargetElement=' + targetElement);\r
// validate the form first\r
if (window.iwfOnFormValidate){\r
if (!iwfOnFormValidate(act)){\r
if (!iwfGetParent(elId)){\r
// our element has not been added to the document yet.\r
iwfAttribute(elId, 'type', 'hidden');\r
- if (!iwfAppendChild(frm, elId)){\r
+ if (!iwfAddChild(frm, elId)){\r
iwfLog('IWF Core Error: Created iwfId element, but could not append to form ' + frm.outerHTML, true);\r
return;\r
}\r
}\r
-//alert(iwfElementToString(elId) + '\n\ndisabled=' + iwfAttribute(elId, 'disabled') + '\n\n' + elId.disabled);\r
}\r
\r
\r
if (!iwfGetParent(elMode)){\r
// our element has not been added to the document yet.\r
iwfAttribute(elMode, 'type', 'hidden');\r
- if (!iwfAppendChild(frm, elMode)){\r
+ if (!iwfAddChild(frm, elMode)){\r
iwfLog('IWF Core Error: Created iwfMode element, but could not append to form ' + frm.outerHTML, true);\r
return;\r
}\r
if (!iwfGetParent(elTarget)){\r
// our element has not been added to the document yet.\r
iwfAttribute(elTarget, 'type', 'hidden');\r
- if (!iwfAppendChild(frm, elTarget)){\r
+ if (!iwfAddChild(frm, elTarget)){\r
iwfLog('IWF Core Error: Created iwfTarget element, but could not append to form ' + frm.outerHTML, true);\r
return;\r
}\r
}\r
} else {\r
// do a normal html submit, since they didn't specify a particular target\r
-alert('doing frm.submit()');\r
+iwfLog('doing frm.submit()', true);\r
frm.submit();\r
}\r
}\r
function iwfMailTo(uid, host){\r
// this is just so an email doesn't have to be output to the browser in raw text for\r
// email harvesters to grab...\r
- return 'mailto:' + uid + '@' + host;\r
+ location.href = 'mailto:' + uid + '@' + host;\r
}\r
\r
function iwfClickLink(id){\r
\r
var _iwfLoggedItems = "";\r
function iwfLog(txt, showAlert){\r
- if (iwfLoggingEnabled){\r
+ if (_iwfLoggingEnabled){\r
_iwfLoggedItems += txt + '\n';\r
} else {\r
- // send to big bit bucket in the sky\r
- // | /dev/null\r
+ //! send to big bit bucket in the sky (/dev/null)\r
}\r
if (showAlert){\r
alert(txt);\r
}\r
\r
function iwfShowLog(){\r
- if (!iwfLoggingEnabled){\r
- alert("Logging for IWF has been disabled.\nSet the iwfLoggingEnabled variable located in the iwfcore.js file to true to enable logging.");\r
+ if (!_iwfLoggingEnabled){\r
+ alert("Logging for IWF has been disabled.\nSet the _iwfLoggingEnabled variable located in the iwfcore.js (or iwfconfig.js) file to true to enable logging.");\r
} else {\r
var el = iwfGetOrCreateById('iwfLog', 'div', 'body');\r
if (!el){\r
-// -----------------------------------------------------------------------------\r
-// IWF - Interactive Website Framework. Javascript library for creating\r
-// responsive thin client interfaces.\r
-//\r
-// Copyright (C) 2005 Brock Weaver brockweaver@gmail.com\r
-//\r
-// This library is free software; you can redistribute it and/or modify\r
-// it under the terms of the GNU Lesser General Public License as published\r
-// by the Free Software Foundation; either version 2.1 of the License, or\r
-// (at your option) any later version.\r
-//\r
-// This library is distributed in the hope that it will be useful, but\r
-// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
-// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
-// License for more details.\r
+// --------------------------------------------------------------------------\r
+/// IWF - Interactive Website Framework. Javascript library for creating\r
+/// responsive thin client interfaces.\r
+///\r
+/// Copyright (C) 2005 Brock Weaver brockweaver@users.sourceforge.net\r
+///\r
+/// This library is free software; you can redistribute it and/or modify\r
+/// it under the terms of the GNU Lesser General Public License as published\r
+/// by the Free Software Foundation; either version 2.1 of the License, or\r
+/// (at your option) any later version.\r
+///\r
+/// This library is distributed in the hope that it will be useful, but\r
+/// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+/// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
+/// License for more details.\r
+///\r
+/// You should have received a copy of the GNU Lesser General Public License\r
+/// along with this library; if not, write to the Free Software Foundation,\r
+/// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+///\r
+/// Brock Weaver\r
+/// brockweaver@users.sourceforge.net\r
+/// 1605 NW Maple Pl\r
+/// Ankeny, IA 50021\r
+///\r
+//! http://iwf.sourceforge.net/\r
+// --------------------------------------------------------------------------\r
+//! NOTE: To minimize file size, strip all fluffy comments (except the LGPL, of course!)\r
+//! using the following regex (global flag and multiline on):\r
+//! ^\t*//([^/!].*|$)\r
//\r
-// You should have received a copy of the GNU Lesser General Public License\r
-// along with this library; if not, write to the Free Software Foundation,\r
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+// This reduces file size by about 30%, give or take.\r
//\r
-// Brock Weaver\r
-// brockweaver@gmail.com\r
-// 1605 NW Maple Pl\r
-// Ankeny, IA 50021\r
-// -----------------------------------------------------------------------------\r
+//! To rip out only logging statements (commented or uncommented):\r
+//! ^/{0,2}iwfLog.*\r
+// --------------------------------------------------------------------------\r
\r
// --------------------------------------------------------------------------\r
-// iwfgui.js\r
+//! iwfgui.js\r
//\r
// GUI inspection and manipulation functions\r
//\r
-// Dependencies:\r
-// iwfcore.js\r
+//! Dependencies:\r
+//! iwfcore.js\r
//\r
-// Brock Weaver - brockweaver@sourceforge.net - iwf.sourceforge.net\r
-// v 0.1 - 2005-06-05\r
-// Initial release.\r
+//! Brock Weaver - brockweaver@users.sourceforge.net\r
+//! v 0.2 - 2005-11-14\r
+//! core bug patch\r
+// --------------------------------------------------------------------------\r
+//! v 0.1 - 2005-06-05\r
+//! Initial release.\r
// --------------------------------------------------------------------------\r
// Issues:\r
// Timeouts have hiccups sometimes when they begin to overlap\r
-// Not tested on Safari -- I need an iMac!\r
+// Not tested on Safari -- I need a Mac!\r
// _iwfMoveTo() has some calculation problems with certain motionType values\r
// --------------------------------------------------------------------------\r
\r
// -----------------------------------\r
// Dependency Check\r
if (!window.iwfGetById){\r
- alert("IWF Dependency Error: you must set a reference to the iwfcore.js file *before* iwfgui.js! I.E.:\n\n<script type='text/javascript' src='iwfcore.js'></script>\n<script type='text/javascript' src='iwfgui.js'></script>");\r
+ iwfLog("IWF Dependency Error: you must set a reference to the iwfcore.js file *before* iwfgui.js! I.E.:\n\n<script type='text/javascript' src='iwfcore.js'></script>\n<script type='text/javascript' src='iwfgui.js'></script>", true);\r
}\r
// -----------------------------------\r
\r
\r
}\r
\r
-// BROCK\r
function iwfDelay(ms, fpOrString){\r
+ // note this inner function creates a closure...\r
function _iwfDelayExpired(){\r
if (localIsString){\r
// passed a string. eval it.\r
-iwfLog("_iwfDelayExpired: calling string of:\n" + localFpOrString, true);\r
+//iwfLog("_iwfDelayExpired: calling string of:\n" + localFpOrString, true);\r
eval(localFpOrString);\r
} else {\r
// they passed a function pointer.\r
\r
function iwfZIndex(id, z){\r
var el = iwfGetById(id);\r
+ if (!el) return 0;\r
+\r
if (iwfExists(el)){\r
if (iwfExists(z)){\r
el.style.zIndex = z;\r
}\r
- return parseInt(el.style.zIndex);\r
+ return iwfToInt(el.style.zIndex, true);\r
}\r
return 0;\r
}\r
var elX = iwfX1(el);\r
var elY = iwfY1(el);\r
\r
- // hack for floating point anomolies -- stops animation when element is "close enough"\r
+ //! hack for floating point anomolies -- stops animation when element is "close enough"\r
var epsilon = 0.001;\r
\r
var xDone = false;\r
}\r
\r
if (ticksLeft <= 0 || (xDone && yDone)){\r
- // time is up. / motion is done\r
+ //! time is up / motion is "close enough"\r
//iwfLog("_iwfMoveTo time is up / motion is done.");\r
iwfX1(el, xDest);\r
iwfY1(el, yDest);\r
// Begin: Size\r
// -----------------------------------\r
\r
+function iwfClientHeight(){\r
+ var vHeight = 0;\r
+ if(document.compatMode == 'CSS1Compat' && document.documentElement && document.documentElement.clientHeight) {\r
+ vHeight = document.documentElement.clientHeight;\r
+ } else if(document.body && document.body.clientHeight) {\r
+ vHeight = document.body.clientHeight;\r
+ } else if(iwfExists(window.innerWidth,window.innerHeight,document.width)) {\r
+ vHeight = window.innerHeight;\r
+ if(document.width>window.innerWidth) {\r
+ vHeight -= 16;\r
+ }\r
+ }\r
+ return vHeight;\r
+}\r
+\r
+function iwfClientWidth(){\r
+ var vWidth = 0;\r
+ if(document.compatMode == 'CSS1Compat' && document.documentElement && document.documentElement.clientWidth) {\r
+ vWidth = document.documentElement.clientWidth;\r
+ } else if(document.body && document.body.clientWidth) {\r
+ vWidth = document.body.clientWidth;\r
+ } else if(iwfExists(window.innerWidth,window.innerHeight,document.height)) {\r
+ vWidth = window.innerWidth;\r
+ if(document.height>window.innerHeight) {\r
+ vWidth -= 16;\r
+ }\r
+ }\r
+ return vWidth;\r
+}\r
+\r
function iwfWidth(id, neww){\r
\r
\r
\r
\r
\r
-// var el = iwfGetById(id);\r
-// var w = 0;\r
-// if (iwfExists(el)){\r
-// if(iwfExists(el.style, el.offsetWidth) && iwfIsString(el.style.width)) {\r
-// if(neww) iwfDetermineWidth(el, neww);\r
-// w = el.offsetWidth;\r
-// }\r
-// else if(iwfExists(el.style) && iwfExists(el.style.pixelWidth)) {\r
-// if(neww) el.style.pixelWidth = neww;\r
-// w = el.style.pixelWidth;\r
-// }\r
-// else if(iwfExists(el.clip) && iwfExists(el.clip.right)) {\r
-// if(neww) e.clip.right = neww;\r
-// w = el.clip.right;\r
-// }\r
-// }\r
-// return w;\r
}\r
\r
function iwfHeight(id, newh){\r
if (iwfExists(el)) {\r
var y1 = iwfY(el);\r
if (iwfExists(y2)){\r
- var h = iwfHeight(el);\r
- iwfHeight(el, y1 + h);\r
+ iwfHeight(el, y2 - y1);\r
}\r
return y1 + iwfHeight(el);\r
}\r
function iwfX2(id, x2){\r
var el = iwfGetById(id);\r
if (iwfExists(el)) {\r
- var x1 = iwfX(id);\r
+ var x1 = iwfX(el);\r
if (iwfExists(x2)){\r
- var w = iwfWidth(id);\r
- iwfWidth(id, x1 + h);\r
+ iwfWidth(el, x2 - x1);\r
}\r
return x1 + iwfWidth(el);\r
}\r
\r
} else if(iwfExists(el.currentStyle,document.compatMode)){\r
if(document.compatMode=='CSS1Compat'){\r
- padl = parseInt(el.currentStyle.paddingLeft);\r
- padr = parseInt(el.currentStyle.paddingRight);\r
- bdrl = parseInt(el.currentStyle.borderLeftWidth);\r
- bdrr = parseInt(el.currentStyle.borderRightWidth);\r
+ padl = iwfToInt(el.currentStyle.paddingLeft, true);\r
+ padr = iwfToInt(el.currentStyle.paddingRight, true);\r
+ bdrl = iwfToInt(el.currentStyle.borderLeftWidth, true);\r
+ bdrr = iwfToInt(el.currentStyle.borderRightWidth, true);\r
}\r
} else if(iwfExists(el.offsetWidth,el.style.width)){\r
el.style.width = neww + 'px';\r
badb = iwfDetermineStyle(el,'border-bottom-height');\r
} else if(iwfExists(el.currentStyle,document.compatMode)){\r
if(document.compatMode=='CSS1Compat'){\r
- padt = parseInt(el.currentStyle.paddingTop);\r
- padb = parseInt(el.currentStyle.paddingBottom);\r
- bdrt = parseInt(el.currentStyle.borderTopHeight);\r
- bdrb = parseInt(el.currentStyle.borderBottomHeight);\r
+ padt = iwfToInt(el.currentStyle.paddingTop, true);\r
+ padb = iwfToInt(el.currentStyle.paddingBottom, true);\r
+ bdrt = iwfToInt(el.currentStyle.borderTopHeight, true);\r
+ bdrb = iwfToInt(el.currentStyle.borderBottomHeight, true);\r
}\r
} else if(iwfExists(el.offsetHeight, el.style.height)){\r
el.style.height = newh + 'px';\r
else el.style.height = h2 + 'px';\r
}\r
\r
+function iwfOverlaps(id1, id2) {\r
+ var el1 = iwfGetById(id1);\r
+ var el2 = iwfGetById(id2);\r
+\r
+ if (!el1 || !el2) return false;\r
+\r
+ var x1a = iwfX(el1);\r
+ var x1b = iwfX2(el1);\r
+ var y1a = iwfY(el1);\r
+ var y1b = iwfY2(el1);\r
+\r
+ var x2a = iwfX(el2);\r
+ var x2b = iwfX2(el2);\r
+ var y2a = iwfY(el2);\r
+ var y2b = iwfY2(el2);\r
+\r
+ if(x1a > x2b || x1b < x2a || y1a > y2b || y1b < y2a) {\r
+ return false;\r
+ } else {\r
+ return true;\r
+ }\r
+\r
+}\r
+\r
+function iwfXCenter(id) {\r
+ var el = iwfGetById(id);\r
+ if (!el) return 0;\r
+ return iwfX(el) + iwfWidth(el) / 2;\r
+}\r
+\r
+function iwfYCenter(id) {\r
+ var el = iwfGetById(id);\r
+ if (!el) return 0;\r
+ return iwfY(el) + iwfHeight(el) / 2;\r
+}\r
\r
// -----------------------------------\r
// End: Size\r
// Begin: Event\r
// -----------------------------------\r
\r
-function iwfAddEvent(id,eventName,callback) {\r
+function iwfAddEvent(id, eventName,callback) {\r
var el = iwfGetById(id);\r
if (!el) return;\r
- if (el.attachEvent) {\r
+\r
+ var txt = callback;\r
+ if (iwfIsString(callback)){\r
+ callback = function() { eval(txt);};\r
+ }\r
+\r
+ if (el.addEventListener) {\r
+ el.addEventListener(eventName.substr(2), callback, false);\r
+ } else if (el.attachEvent) {\r
+//iwfLog('attaching event ' + eventName + ' to element ' + el.id + ' with the callback:\n' + callback, true);\r
el.attachEvent(eventName, callback);\r
} else {\r
- el[eventName] = callback;\r
+ iwfLog("Couldn't add event " + eventName + " to element " + el.id + " because neither addEventListener nor attachEvent are implemented.", true);\r
}\r
}\r
\r
function iwfRemoveEvent(id, eventName, callback){\r
var el = iwfGetById(id);\r
if (!el) return;\r
- if (el.detachEvent) el.detachEvent(eventName, callback);\r
- else eval('el.' + eventName + ' = null;');\r
+ if (el.removeEventListener) {\r
+ el.removeEventListener(eventName.substr(2), callback, false);\r
+ } else if (el.detachEvent) {\r
+ el.detachEvent(eventName, callback);\r
+ } else {\r
+ iwfLog("Couldn't remove event " + eventName + " from element " + el.id + " because neither removeEventListener nor detachEvent are implemented.", true);\r
+ }\r
+}\r
+\r
+function iwfCallAttribute(id, eventName, evt){\r
+ var el = iwfGetById(id);\r
+ if (!el) return false;\r
+\r
+ var val = iwfAttribute(el, eventName);\r
+//iwfLog("calling attribute " + eventName + "=" + val, true);\r
+ if (val){\r
+ eval(val);\r
+ }\r
+\r
+ return;\r
+\r
+\r
+\r
+\r
+ if (el.fireEvent){\r
+iwfLog("firing event " + eventName + " on el " + el.id);\r
+ el.fireEvent(eventName, evt);\r
+ } else if (el.dispatchEvent){\r
+ // chop off the "on" at the beginning...\r
+// eventName = eventName.substr(2);\r
+// iwfLog(eventName, true);\r
+ var newEvent = null;\r
+ if (document.createEvent){\r
+ newEvent = document.createEvent("Events");\r
+ } else {\r
+ newEvent = document.createEventObject();\r
+ }\r
+ newEvent.initEvent(eventName, true, true); //, document.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);\r
+iwfLog("dispatching event " + eventName + " on el " + el.id);\r
+ if (!el.dispatchEvent(newEvent)){\r
+iwfLog("Could not el.dispatchEvent failed!", true);\r
+ }\r
+ } else {\r
+iwfLog("Could not el.fireEvent or el.dispatchEvent!", true);\r
+ }\r
}\r
\r
function iwfEvent(ev) {\r
if(evt.target) this.target = evt.target;\r
else if(evt.srcElement) this.target = evt.srcElement;\r
\r
+ this.X = iwfX(evt.target);\r
+ this.Y = iwfY(evt.target);\r
+\r
if(iwfExists(evt.clientX,evt.clientY)) {\r
this.X = evt.clientX + iwfXScroll();\r
this.Y = evt.clientY + iwfYScroll();\r
// Begin: Drag-N-Drop\r
// -----------------------------------\r
\r
-var iwfDragger = {el:null, inUse:false};\r
+var iwfDragger = {el:null, curTarget:null, targets:new Array()};\r
var iwfHiZ = 2;\r
\r
-function iwfEnableDrag(id, startCallback, dragCallback, endCallback) {\r
+var iwfResizer = {elSrc:null, elTgt:null};\r
+\r
+function iwfResize(resizeId, targetId){\r
+ var resizer = iwfGetById(resizeId);\r
+ if (!resizer) return;\r
+\r
+ var target = iwfGetById(targetId);\r
+ if (!target) return;\r
+\r
+ iwfResizer.elSrc = resizer;\r
+ iwfResizer.elTgt = target;\r
+\r
+\r
+ // set the drag start / move / stop\r
+ iwfAttribute(resizer, 'iwfdragbegin', 'iwfResizeStart()');\r
+ iwfAttribute(resizer, 'iwfdragmove', 'iwfResizeMove()');\r
+ iwfAttribute(resizer, 'iwfdragend', 'iwfResizeEnd()');\r
+\r
+ iwfDrag(resizer);\r
+\r
+}\r
+\r
+function iwfResizeStart(){\r
+\r
+}\r
+\r
+function iwfResizeMove(resizeId, targetId){\r
+ // elSrc should have already been moved to its new location.\r
+ // make elTgt fit to it.\r
+ var tgtX = iwfX(iwfResizer.elTgt);\r
+ var tgtY = iwfY(iwfResizer.elTgt);\r
+\r
+ var srcX2 = iwfX2(iwfResizer.elSrc);\r
+ if (srcX2 - 100 < tgtX){\r
+ srcX2 = tgtX + 100;\r
+ }\r
+\r
+ var srcY2 = iwfY2(iwfResizer.elSrc);\r
+ if (srcY2 - 50 < tgtY){\r
+ srcY2 = tgtY + 50;\r
+ }\r
+//iwfLog("srcX2:" + srcX2 + "\tsrcY2:" + srcY2);\r
+// iwfX1(iwfResizer.elSrc, srcX2 - iwfWidth(iwfResizer.elSrc));\r
+// iwfY1(iwfResizer.elSrc, srcY2 - iwfHeight(iwfResizer.elSrc));\r
+\r
+// iwfX2(iwfResizer.elTgt, srcX2);\r
+// iwfY2(iwfResizer.elTgt, srcY2);\r
+\r
+ // if container exists, make it occupy all but titlebar space...\r
+ if (iwfResizer.elTgt){\r
+ var elContainer = iwfGetById(iwfResizer.elTgt.id + 'Container');\r
+ if (elContainer){\r
+ iwfHeight(elContainer, iwfHeight(iwfResizer.elTgt) - iwfHeight(iwfResizer.elTgt.id + 'TitleBar') - 2);\r
+ }\r
+ }\r
+\r
+\r
+}\r
+\r
+function iwfResizeEnd(){\r
+\r
+iwfLog(iwfElementToString(iwfResizer.elSrc), true);\r
+\r
+ iwfResizer.elSrc = null;\r
+ iwfResizer.elTgt = null;\r
+}\r
+\r
+function iwfDrag(id) {\r
+\r
var el = iwfGetById(id);\r
if (!el) return;\r
- el.iwfDraggable = true;\r
- el.iwfOnDragStart = startCallback;\r
- el.iwfOnDrag = dragCallback;\r
- el.iwfOnDragEnd = endCallback;\r
- iwfAddEvent(el, 'onmousedown', iwfDragMouseDown);\r
- if (!iwfDragger.inUse) {\r
- iwfDragger.inUse = true;\r
- iwfAddEvent(document, 'onmousemove', iwfDragMouseMove);\r
+\r
+//iwfLog(iwfElementToString(el), true);\r
+ if (!iwfDragger.el) {\r
+ el.iwfDragTarget = true;\r
+ iwfAddEvent(el, 'onmousedown', iwfDragMouseDown);\r
+ // BROCK: sync issues here in IE when there is no container.\r
+ // HACK: force a container always? hmmmm...\r
+// iwfFireEvent(el, 'onmousedown');\r
}\r
}\r
function iwfDragMouseDown(ev){\r
+\r
var evt = new iwfEvent(ev);\r
var el = evt.target;\r
- while(el && !el.iwfDraggable) {\r
- el = iwfParent(el);\r
+ while(el && !el.iwfDragTarget) {\r
+ el = iwfGetParent(el);\r
}\r
if (el) {\r
+\r
+ iwfDragger.el = el;\r
+\r
+ iwfAddEvent(document, 'onmousemove', iwfDragMouseMove);\r
+ iwfAddEvent(document, 'onmouseup', iwfDragMouseUp);\r
+\r
+\r
+\r
if (ev && ev.preventDefault) ev.preventDefault();\r
else if (window.event) window.event.returnValue = false;\r
- el.iwfDragX = evt.X;\r
- el.iwfDragY = evt.Y;\r
+ else if (iwfExists(ev.cancelBubble)) ev.cancelBubble = true;\r
+\r
+ el.iwfDragOrigX = iwfX(el);\r
+ el.iwfDragOrigY = iwfY(el);\r
+ el.iwfDragOffsetX = evt.X - iwfX(el);\r
+ el.iwfDragOffsetY = evt.Y - iwfY(el);\r
+\r
\r
iwfZIndex(el, iwfHiZ++);\r
\r
- iwfDragger.el = el;\r
- iwfAddEvent(document, 'onmouseup', iwfDragMouseUp, false);\r
- if (el.iwfOnDragStart) {\r
- el.iwfOnDragStart(el, evt.X, evt.Y);\r
- }\r
+ iwfCallAttribute(el, 'iwfdragbegin');\r
}\r
}\r
\r
function iwfDragMouseMove(ev){\r
var evt = new iwfEvent(ev);\r
+\r
if (iwfDragger.el) {\r
- if (ev && ev.preventDefault) ev.preventDefault();\r
+ if (evt && evt.preventDefault) evt.preventDefault();\r
else if (window.event) window.event.returnValue = false;\r
+ else if (iwfExists(ev.cancelBubble)) ev.cancelBubble = true;\r
+\r
var el = iwfDragger.el;\r
- var dx = evt.X - el.iwfDragX;\r
- var dy = evt.Y - el.iwfDragY;\r
- el.iwfDragX = evt.X;\r
- el.iwfDragY = evt.Y;\r
\r
- if (el.iwfOnDrag) {\r
- el.iwfOnDrag(el, dx, dy);\r
- } else {\r
- iwfX(el, iwfX(el) + dx);\r
- iwfY(el, iwfY(el) + dy);\r
+\r
+ var newX = evt.X - el.iwfDragOffsetX;\r
+ if (newX > iwfClientWidth() - iwfWidth(el)){\r
+ newX = iwfClientWidth() - iwfWidth(el);\r
+ }\r
+ if (newX < 0) {\r
+ newX = 0;\r
}\r
+\r
+ var newY = evt.Y - el.iwfDragOffsetY;\r
+ if (newY > iwfClientHeight() - iwfHeight(el)){\r
+ newY = iwfClientHeight() - iwfHeight(el);\r
+ }\r
+ if (newY < 0) {\r
+ newY = 0;\r
+ }\r
+\r
+\r
+ iwfX(el, newX);\r
+ iwfY(el, newY);\r
+\r
+ // and hilite any drop targets...\r
+ for(var i=0;i<iwfDragger.targets.length;i++){\r
+ if (!iwfDragger.curTarget && iwfOverlaps(iwfDragger.targets[i], iwfDragger.el)) {\r
+ iwfDragOver(iwfDragger.targets[i]);\r
+ break;\r
+ }\r
+ }\r
+\r
+ iwfCallAttribute(el, 'iwfdragmove');\r
+\r
}\r
}\r
+\r
function iwfDragMouseUp(ev) {\r
if (iwfDragger.el) {\r
if (ev && ev.preventDefault) ev.preventDefault();\r
else if (window.event) window.event.returnValue = false;\r
- iwfRemoveEvent(document, 'onmouseup', iwfDragMouseUp, false);\r
- if (iwfDragger.el.iwfOnDragEnd) {\r
- var evt = new iwfEvent(ev);\r
- iwfDragger.el.iwfOnDragEnd(iwfDragger.el, evt.X, evt.Y);\r
- }\r
+ else if (iwfExists(ev.cancelBubble)) ev.cancelBubble = true;\r
+\r
+ var evt = new iwfEvent(ev);\r
+ iwfRemoveEvent(document, 'onmousedown', iwfDragMouseDown);\r
+ iwfRemoveEvent(document, 'onmousemove', iwfDragMouseMove);\r
+ iwfRemoveEvent(document, 'onmouseup', iwfDragMouseUp);\r
+\r
+ iwfCallAttribute(iwfDragger.el, 'iwfdragend');\r
+\r
+ iwfDragDrop();\r
+ iwfDragger.el.iwfDragTarget = false;\r
iwfDragger.el = null;\r
}\r
}\r
\r
+function iwfDragOver(idTarget) {\r
+ var tgt = iwfGetById(idTarget);\r
+ if (!tgt) return;\r
+\r
+ if (!iwfDragger.el) return;\r
+\r
+ if (iwfDragger.curTarget) return;\r
+\r
+\r
+ iwfDragger.curTarget = tgt.id;\r
+\r
+\r
+ tgt.iwfBackgroundColor = tgt.style.backgroundColor;\r
+ tgt.style.backgroundColor = '#efefef';\r
+\r
+ iwfDragger.el.iwfBorder = iwfDragger.el.style.border;\r
+ iwfDragger.el.style.border = '3px solid blue';\r
+\r
+}\r
+\r
+function iwfDragOut() {\r
+\r
+ var tgt = iwfGetById(iwfDragger.curTarget);\r
+ if (!tgt) return;\r
+\r
+ iwfDragger.curTarget = null;\r
+\r
+\r
+ if (!iwfDragger.el) return;\r
+\r
+\r
+\r
+ iwfDragger.el.style.border = iwfDragger.el.iwfBorder;\r
+ tgt.style.backgroundColor = tgt.iwfBackgroundColor;\r
+\r
+\r
+}\r
+\r
+function iwfDragDrop() {\r
+\r
+ var tgt = iwfGetById(iwfDragger.curTarget);\r
+\r
+ iwfDragOut(iwfDragger.curTarget);\r
+\r
+\r
+\r
+ if (!iwfDragger.el) return;\r
+\r
+ var src = iwfGetById(iwfDragger.el);\r
+\r
+ if (src) {\r
+ if (!tgt) {\r
+ if (iwfDragger.targets.length > 0) {\r
+ // targets exist, but none were dropped on. return to original x/y\r
+ iwfMoveTo(tgt, iwfAttribute(iwfDragger.el, 'iwfDragOrigX'), iwfAttribute(iwfDragger.el, 'iwfDragOrigY'), 30);\r
+ }\r
+ } else {\r
+ // target found. dock to it.\r
+ iwfDockTo(tgt, src, "tl", "tl", 30);\r
+ }\r
+ }\r
+}\r
+\r
+function iwfMapDropTargets(node) {\r
+\r
+ if (!node || !node.childNodes) {\r
+iwfLog('No childNodes found for ' + iwfElementToString(node), true);\r
+ return;\r
+ }\r
+\r
+ for(var i=0; i<node.childNodes.length;i++){\r
+iwfLog('child=' + iwfElementToString(node.childNodes[i]), true);\r
+ if (iwfAttribute(node.childNodes[i], 'iwfDropTarget') == 'true'){\r
+ iwfDragger.targets.push(iwfAttribute(node.childNodes[i], 'id'));\r
+ }\r
+ iwfMapDropTargets(node.childNodes[i]);\r
+ }\r
+\r
+\r
+}\r
+\r
+function iwfMapDraggables(node){\r
+ if (!node) {\r
+iwfLog("when mapping windows, node not found");\r
+ return;\r
+ } else if (!node.childNodes){\r
+iwfLog("No childNodes found for " + iwfElementToString(node.childNodes[i]));\r
+ return;\r
+ }\r
+\r
+ for(var i=0; i<node.childNodes.length;i++){\r
+ if (iwfAttribute(node.childNodes[i], 'iwfDraggable') == 'true'){\r
+iwfLog("Found draggable to map: " + iwfElementToString(node.childNodes[i]));\r
+ iwfMakeDraggable(node.childNodes[i]);\r
+ }\r
+ }\r
+}\r
+\r
+function iwfMakeDraggable(id){\r
+ var el = iwfGetById(id);\r
+ if (!el) return;\r
+\r
+ if (iwfAttribute(el, 'iwfDraggableMapped') == 'true'){\r
+ // element has already been mapped for dragging. escape.\r
+ return;\r
+ }\r
+\r
+ // mark it as being mapped as a drag target\r
+ iwfAttribute(el, 'iwfDraggableMapped', 'true');\r
+ iwfAttribute(el, 'iwfDragTarget', 'true');\r
+\r
+ // make sure window is absolutely positioned and overflow is okay\r
+ el.style.position = 'absolute';\r
+ el.style.overflow = 'hidden';\r
+ el.style.cursor = 'move';\r
+\r
+ iwfAddEvent(el, 'onmousedown', 'iwfDrag("' + el.id + '");');\r
+\r
+}\r
+\r
+function iwfMapWindows(node){\r
+ if (!node) {\r
+iwfLog("when mapping windows, node not found");\r
+ return;\r
+ } else if (!node.childNodes){\r
+iwfLog("No childNodes found for " + iwfElementToString(node.childNodes[i]));\r
+ return;\r
+ }\r
+\r
+ for(var i=0; i<node.childNodes.length;i++){\r
+ if (iwfAttribute(node.childNodes[i], 'iwfWindow') == 'true'){\r
+iwfLog("Found window to map: " + iwfElementToString(node.childNodes[i]));\r
+ iwfGetOrCreateWindow(node.childNodes[i]);\r
+ }\r
+ }\r
+}\r
+\r
+function iwfGetOrCreateWindow(id){\r
+ var el = iwfGetById(id);\r
+ if (!el) return null;\r
+\r
+ if (iwfAttribute(el, 'iwfWindowCreated') == 'true'){\r
+ // window has already been created. escape.\r
+ return;\r
+ }\r
+\r
+ // make sure window is absolutely positioned and overflow is okay\r
+ el.style.position = 'absolute';\r
+ el.style.overflow = 'hidden';\r
+\r
+ // create a title bar\r
+ var elTitle = iwfGetOrCreateById(el.id + 'TitleBar', 'div');\r
+ if (!elTitle) return;\r
+\r
+ elTitle.style.backgroundColor = 'navy';\r
+ elTitle.style.color = 'white';\r
+ elTitle.style.cursor = 'move';\r
+ elTitle.innerHTML = " " + iwfAttribute(el, 'iwfWindowTitle');\r
+\r
+ // dragging title bar should move the window\r
+ iwfAddEvent(elTitle, 'onmousedown', 'iwfDrag("' + el.id + '");');\r
+\r
+\r
+ // create the container which will contain all other html specified in the div\r
+ var elContainer = iwfGetOrCreateById(el.id + 'Container', 'div');\r
+ if (!elContainer) return;\r
+\r
+ elContainer.style.width='100%';\r
+ elContainer.style.height='90%';\r
+ elContainer.style.overflow='scroll';\r
+\r
+ // transfer window contents into the new container\r
+ elContainer.innerHTML = el.innerHTML;\r
+ // clear the window\r
+ el.innerHTML = '';\r
+\r
+\r
+ // create the resizer which will handle resizing\r
+ var elResizer = iwfGetOrCreateById(el.id + 'Resizer', 'div');\r
+ if (!elResizer) return;\r
+\r
+\r
+ elResizer.innerHTML = "<table border='0' cellspacing='0' cellpadding='0' width='100%' height='3px' ><tr ><td width='95%' style='cursor:s-resize'> </td><td style='cursor:se-resize'> </td></tr></table>";\r
+// elResizer.innerHTML = '<span style="width:90%;background-color:red;color:white;cursor:s-resize;padding-right:30px;">blah</span><span style="width:20px;color:black;background-color:gray;cursor:se-resize">*</span>';\r
+\r
+\r
+\r
+ // set style properties on resizer\r
+// iwfX(elResizer, iwfX(el) + 20);\r
+// iwfY(elResizer, iwfY(el) + 20);\r
+// iwfZIndex(elResizer, 9999999);\r
+// iwfHeight(elResizer, 15);\r
+// iwfWidth(elResizer, 15);\r
+// elTitle.style.cursor = 'move';\r
+// elResizer.style.position = 'absolute';\r
+// elResizer.style.borderStyle = 'solid';\r
+// elResizer.style.borderColor = 'black';\r
+// elResizer.style.borderWidth = '1px';\r
+// elResizer.backgroundColor = 'white';\r
+// elResizer.style.overflow = 'hidden';\r
+// elResizer.style.textAlign = 'center';\r
+// elResizer.style.cursor = 'se-resize';\r
+// elResizer.innerHTML = '-';\r
+\r
+ // dragging the resizer should resize the window\r
+ iwfAddEvent(elResizer, 'onmousedown', 'iwfResize("' + elResizer.id + '","' + el.id + '");');\r
+\r
+\r
+ // add title bar to window\r
+ iwfAddChild(el, elTitle, true);\r
+\r
+ // add container to window\r
+ iwfAddChild(el, elContainer);\r
+\r
+ // add resizer to window\r
+ iwfAddChild(el, elResizer);\r
+\r
+// iwfX(elResizer, iwfX2(el) - 15);\r
+// iwfY(elResizer, iwfY2(el) - 15);\r
+\r
+iwfLog(iwfElementToString(elResizer),true);\r
+\r
+ // align resizer to bottom right of window\r
+ iwfResize(elResizer, el);\r
+\r
+\r
+\r
+ // add the flag saying we've created the window\r
+ iwfAttribute(el, 'iwfWindowCreated', 'true');\r
+\r
+\r
+}\r
+\r
// -----------------------------------\r
// End: Drag-N-Drop\r
// -----------------------------------\r
\r
-// -----------------------------------\r
-// Begin: Initializers\r
-// -----------------------------------\r
-iwfMapRollovers();\r
-// -----------------------------------\r
-// End: Initializers\r
-// -----------------------------------\r
-// -----------------------------------------------------------------------------\r
-// IWF - Interactive Website Framework. Javascript library for creating\r
-// responsive thin client interfaces.\r
-//\r
-// Copyright (C) 2005 Brock Weaver brockweaver@gmail.com\r
-//\r
-// This library is free software; you can redistribute it and/or modify\r
-// it under the terms of the GNU Lesser General Public License as published\r
-// by the Free Software Foundation; either version 2.1 of the License, or\r
-// (at your option) any later version.\r
-//\r
-// This library is distributed in the hope that it will be useful, but\r
-// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
-// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
-// License for more details.\r
+// --------------------------------------------------------------------------\r
+/// IWF - Interactive Website Framework. Javascript library for creating\r
+/// responsive thin client interfaces.\r
+///\r
+/// Copyright (C) 2005 Brock Weaver brockweaver@users.sourceforge.net\r
+///\r
+/// This library is free software; you can redistribute it and/or modify\r
+/// it under the terms of the GNU Lesser General Public License as published\r
+/// by the Free Software Foundation; either version 2.1 of the License, or\r
+/// (at your option) any later version.\r
+///\r
+/// This library is distributed in the hope that it will be useful, but\r
+/// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+/// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public\r
+/// License for more details.\r
+///\r
+/// You should have received a copy of the GNU Lesser General Public License\r
+/// along with this library; if not, write to the Free Software Foundation,\r
+/// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+///\r
+/// Brock Weaver\r
+/// brockweaver@users.sourceforge.net\r
+/// 1605 NW Maple Pl\r
+/// Ankeny, IA 50021\r
+///\r
+//! http://iwf.sourceforge.net/\r
+// --------------------------------------------------------------------------\r
+//! NOTE: To minimize file size, strip all fluffy comments (except the LGPL, of course!)\r
+//! using the following regex (global flag and multiline on):\r
+//! ^\t*//([^/!].*|$)\r
//\r
-// You should have received a copy of the GNU Lesser General Public License\r
-// along with this library; if not, write to the Free Software Foundation,\r
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+// This reduces file size by about 30%, give or take.\r
//\r
-// Brock Weaver\r
-// brockweaver@gmail.com\r
-// 1605 NW Maple Pl\r
-// Ankeny, IA 50021\r
-// -----------------------------------------------------------------------------\r
+//! To rip out only logging statements (commented or uncommented):\r
+//! ^/{0,2}iwfLog.*\r
+// --------------------------------------------------------------------------\r
\r
// --------------------------------------------------------------------------\r
-// iwfxml.js\r
+//! iwfxml.js\r
//\r
// Javascript-based xml parser\r
//\r
-// Dependencies:\r
-// iwfcore.js\r
+//! Dependencies:\r
+//! iwfcore.js\r
//\r
-// Brock Weaver - brockweaver@sourceforge.net - iwf.sourceforge.net\r
-// v 0.1 - 2005-06-05\r
-// Initial release.\r
+//! Brock Weaver - brockweaver@users.sourceforge.net\r
+//! v 0.2 - 2005-11-14\r
+//! core bug patch\r
+// --------------------------------------------------------------------------\r
+//! Brock Weaver - brockweaver@users.sourceforge.net\r
+//! v 0.1 - 2005-06-05\r
+//! Initial release.\r
// --------------------------------------------------------------------------\r
// This class is meant to ease the burden of parsing xml.\r
// Xml is parsed into sets of arrays, in a hierarchical format.\r
\r
\r
// --------------------------------------------------------------------------\r
-// iwfXmlNode\r
+//! iwfXmlNode\r
//\r
-// Brock Weaver - brockweaver@gmail.com\r
-// v 0.1 - 2005-06-05\r
-// Initial release.\r
+//! Brock Weaver - brockweaver@users.sourceforge.net\r
+//! v 0.1 - 2005-06-05\r
+//! Initial release.\r
// --------------------------------------------------------------------------\r
// This class is used to represent a single xml node.\r
// All xml is kept except processing instructions.\r
\r
\r
// --------------------------------------------------------------------------\r
-// iwfWriter\r
+//! iwfWriter\r
//\r
-// Brock Weaver - brockweaver@gmail.com\r
+//! Brock Weaver - brockweaver@users.sourceforge.net\r
//\r
-// v 0.1 - 2005-06-05\r
-// Initial release.\r
+//! v 0.1 - 2005-06-05\r
+//! Initial release.\r
// --------------------------------------------------------------------------\r
// This class is meant to ease the creation of xml strings.\r
// Note it is not a fully-compliant xml generator.\r
} else {\r
// we're using quotes to delimit html\r
attval = attval.replace(/'/gi, "\\'").replace(/"/gi, '"').replace(/>/gi, '>');\r
-// attval = attval.replace(/&/gi, '&').replace(/"/gi, '"').replace(/</gi, '<').replace(/>/gi, '>');\r
}\r
} else {\r
attval = iwfXmlEncode(attval);\r
break;\r
default:\r
if (this._nodeOpened){\r
- // hack for <script /> needing to be <script></script>\r
+ //! hack for <script /> and <div /> needing to be <script></script> or <div></div>\r
switch(name){\r
case 'script':\r
+ case 'div':\r
this.writeRaw("></" + name + ">");\r
break;\r
default:\r