Commit 986ddcfcb2fff158d45da4008a39abc7ddece708
1 parent
633174f5
Reverted file line endings back to UNIX(LF)
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6345 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
67 additions
and
67 deletions
resources/js/collectionframe.js
| 1 | -function _getParentElm(elm, type) { | ||
| 2 | - var n = elm.parentNode; | ||
| 3 | - | ||
| 4 | - if(isUndefinedOrNull(n)) { | ||
| 5 | - return false; | ||
| 6 | - } | ||
| 7 | - | ||
| 8 | - if(n.nodeName == type) { | ||
| 9 | - return n; | ||
| 10 | - } | ||
| 11 | - | ||
| 12 | - return _getParentElm(n, type); | ||
| 13 | -} | ||
| 14 | - | ||
| 15 | -function _getContentDocument(id) { | ||
| 16 | - var elm = $(id); | ||
| 17 | - var ret = null; | ||
| 18 | - | ||
| 19 | - if(elm.contentDocument) { | ||
| 20 | - ret = elm.contentDocument; | ||
| 21 | - } else { | ||
| 22 | - if(elm.id) { | ||
| 23 | - id = elm.id; | ||
| 24 | - } | ||
| 25 | - ret = document.frames[id].document; | ||
| 26 | - } | ||
| 27 | - return ret; | ||
| 28 | -} | ||
| 29 | - | ||
| 30 | -function resizeFrame(elm) { | ||
| 31 | - var frame = $(elm); | ||
| 32 | - var size = _getContentDocument(elm).body.offsetHeight; | ||
| 33 | - frame.style.display = 'block'; | ||
| 34 | - frame.style.height = (parseInt(size) + 32) + 'px'; | ||
| 35 | -} | ||
| 36 | - | ||
| 37 | -function setupFrame(frame) { | ||
| 38 | - var form = _getParentElm(frame, 'FORM'); | ||
| 39 | - var moveInputs = function(event) { | ||
| 40 | - for(var e in Set('input', 'select', 'textarea')) { | ||
| 41 | - var elms = _getContentDocument(frame).getElementsByTagName(e); | ||
| 42 | - if(!elms.length) { | ||
| 43 | - continue; | ||
| 44 | - } | ||
| 45 | - forEach(elms, function(v) { | ||
| 46 | -//rrr fix for correct document linking r.m. 11.01.2007 | ||
| 47 | -if(v.type=='radio') { if (!v.checked){ return; }} | ||
| 48 | -//rre | ||
| 49 | - var newInput = INPUT({'type':'hidden', | ||
| 50 | - 'name':v.name, | ||
| 51 | - 'value':v.value}); | ||
| 52 | - appendChildNodes(form, newInput); | ||
| 53 | - }); | ||
| 54 | - } | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - resizeFrame(frame); | ||
| 58 | - connect(frame, 'onload', function(e) { resizeFrame(e.src()); }); | ||
| 59 | - connect(form, 'onsubmit', moveInputs); | ||
| 60 | -} | ||
| 61 | - | ||
| 62 | - | ||
| 63 | -addLoadEvent(function() { | ||
| 64 | - var frames = getElementsByTagAndClassName('iframe', 'browse-frame'); | ||
| 65 | - forEach(frames, setupFrame); | ||
| 66 | - }); | ||
| 67 | - | 1 | +function _getParentElm(elm, type) { |
| 2 | + var n = elm.parentNode; | ||
| 3 | + | ||
| 4 | + if(isUndefinedOrNull(n)) { | ||
| 5 | + return false; | ||
| 6 | + } | ||
| 7 | + | ||
| 8 | + if(n.nodeName == type) { | ||
| 9 | + return n; | ||
| 10 | + } | ||
| 11 | + | ||
| 12 | + return _getParentElm(n, type); | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | +function _getContentDocument(id) { | ||
| 16 | + var elm = $(id); | ||
| 17 | + var ret = null; | ||
| 18 | + | ||
| 19 | + if(elm.contentDocument) { | ||
| 20 | + ret = elm.contentDocument; | ||
| 21 | + } else { | ||
| 22 | + if(elm.id) { | ||
| 23 | + id = elm.id; | ||
| 24 | + } | ||
| 25 | + ret = document.frames[id].document; | ||
| 26 | + } | ||
| 27 | + return ret; | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +function resizeFrame(elm) { | ||
| 31 | + var frame = $(elm); | ||
| 32 | + var size = _getContentDocument(elm).body.offsetHeight; | ||
| 33 | + frame.style.display = 'block'; | ||
| 34 | + frame.style.height = (parseInt(size) + 32) + 'px'; | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +function setupFrame(frame) { | ||
| 38 | + var form = _getParentElm(frame, 'FORM'); | ||
| 39 | + var moveInputs = function(event) { | ||
| 40 | + for(var e in Set('input', 'select', 'textarea')) { | ||
| 41 | + var elms = _getContentDocument(frame).getElementsByTagName(e); | ||
| 42 | + if(!elms.length) { | ||
| 43 | + continue; | ||
| 44 | + } | ||
| 45 | + forEach(elms, function(v) { | ||
| 46 | + | ||
| 47 | + if(v.type=='radio') { if (!v.checked){ return; }} | ||
| 48 | + | ||
| 49 | + var newInput = INPUT({'type':'hidden', | ||
| 50 | + 'name':v.name, | ||
| 51 | + 'value':v.value}); | ||
| 52 | + appendChildNodes(form, newInput); | ||
| 53 | + }); | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + resizeFrame(frame); | ||
| 58 | + connect(frame, 'onload', function(e) { resizeFrame(e.src()); }); | ||
| 59 | + connect(form, 'onsubmit', moveInputs); | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | + | ||
| 63 | +addLoadEvent(function() { | ||
| 64 | + var frames = getElementsByTagAndClassName('iframe', 'browse-frame'); | ||
| 65 | + forEach(frames, setupFrame); | ||
| 66 | + }); | ||
| 67 | + |