[LON-CAPA-cvs] cvs: rat / lonratedt.pm /client ratcode.js
damieng
damieng at source.lon-capa.org
Fri Jan 15 14:13:09 EST 2016
damieng Fri Jan 15 19:13:09 2016 EDT
Modified files:
/rat lonratedt.pm
/rat/client ratcode.js
Log:
fixed layout issues in advanced RAT, replaced frameset by iframes
-------------- next part --------------
Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.111 rat/lonratedt.pm:1.112
--- rat/lonratedt.pm:1.111 Tue May 20 14:36:39 2014
+++ rat/lonratedt.pm Fri Jan 15 19:13:04 2016
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Edit Handler for RAT Maps
#
-# $Id: lonratedt.pm,v 1.111 2014/05/20 14:36:39 raeburn Exp $
+# $Id: lonratedt.pm,v 1.112 2016/01/15 19:13:04 damieng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -43,28 +43,89 @@
# --------------------------------------------------------- Build up RAT screen
sub ratedt {
my ($r,$url)=@_;
- my %layout = ('border' => "0",
- 'rows' => "1,250,*");
- my $js ='
-<script type="text/javascript">
- var flag=0;
-</script>';
-
- my $start_page =
- &Apache::loncommon::start_page('Edit Sequence',$js,
- {'frameset' => 1,
- 'add_entries' => \%layout});
-
- my $end_page =
- &Apache::loncommon::end_page({'frameset' => 1});
-
$r->print(<<ENDDOCUMENT);
-$start_page
-<frame name="server" src="$url/loadonly/ratserver" noresize="noresize"
- noscroll="noscroll" />
-<frame name="code" src="$url/loadonly/adveditmenu" />
-<frame name="mapout" src="/adm/rat/map.html" />
-$end_page
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Edit Sequence</title>
+
+ <style>
+html, body {
+ margin: 0;
+ padding: 0;
+}
+#server {
+ display: none;
+}
+#top {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 20%;
+ border: 0;
+}
+#bottom {
+ position: absolute;
+ left: 0;
+ bottom: 0;
+ width: 100%;
+ height: 80%;
+ border: 0;
+}
+#code, #mapout {
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ border: 0;
+}
+#infout {
+ position: absolute;
+ z-index: 1;
+ right: 16px;
+ bottom: 0;
+ width: 420px;
+ min-width: 200px;
+ height: 300px;
+ border: 1px solid black;
+ overflow: auto;
+}
+ </style>
+ </head>
+
+ <body>
+ <iframe id="server" name="server" src="$url/loadonly/ratserver"></iframe>
+ <div id="top"><iframe id="code" name="code" src="$url/loadonly/adveditmenu"></iframe></div>
+ <div id="bottom"><iframe id="mapout" name="mapout" src="/adm/rat/map.html"></iframe></div>
+ <iframe id="infout"></iframe>
+ <script>
+var flag=0;
+
+var resize = function(e) {
+ // auto-resize top iframe
+ var code = document.getElementById('code');
+ var codedoc = (code.contentDocument) ? code.contentDocument : code.contentWindow.document;
+ var top = document.getElementById('top');
+ top.style.height = ''; // reset height in case it needs to be reduced
+ codedoc.body.style.overflow = 'hidden'; // to hide scrollbar
+ var topHeight = codedoc.body.scrollHeight;
+ top.style.height = topHeight + 'px';
+ // set remainder to the other iframe
+ var bottom = document.getElementById('bottom');
+ bottom.style.height = window.innerHeight - topHeight + 'px';
+ // fix right position of infout depending on scrollbar width
+ var mapout = document.getElementById('mapout');
+ var mapoutdoc = (mapout.contentDocument) ? mapout.contentDocument : mapout.contentWindow.document;
+ var infout = document.getElementById('infout');
+ infout.style.right = (mapout.offsetWidth - mapoutdoc.body.clientWidth) + 'px';
+}
+var iframe = document.getElementById('code');
+iframe.onload = resize;
+window.addEventListener('resize', resize, false);
+ </script>
+
+ </body>
+</html>
ENDDOCUMENT
}
Index: rat/client/ratcode.js
diff -u rat/client/ratcode.js:1.13 rat/client/ratcode.js:1.14
--- rat/client/ratcode.js:1.13 Mon Nov 21 14:29:06 2011
+++ rat/client/ratcode.js Fri Jan 15 19:13:08 2016
@@ -1,7 +1,7 @@
<!--
The LearningOnline Network
Resource Assembly Tool
-// $Id: ratcode.js,v 1.13 2011/11/21 14:29:06 raeburn Exp $
+// $Id: ratcode.js,v 1.14 2016/01/15 19:13:08 damieng Exp $
//
// Copyright Michigan State University Board of Trustees
//
@@ -1405,7 +1405,7 @@
infcheck();
inf.document.open();
inf.document.writeln
- ('<html><body bgcolor="#FFFFFF"><table><tr><td>'+
+ ('<html><body style="background-color:white; margin: 0"><table style="font-size: 90%;"><tr><td>'+
'<img src="/adm/lonIcons/lonlogos.gif" /></td>');
if (linkmode!=0) {
if (tablemode==0) {
@@ -1430,6 +1430,10 @@
}
inf.document.writeln('</tr></table></body></html>');
inf.document.close();
+ inf.opener = window;
+ var infout = parent.document.getElementById('infout')
+ infout.style.width = '500px';
+ infout.style.width = inf.document.body.firstChild.offsetWidth + 10 + 'px';
if (srchflag==1) {
srchclose();
}
@@ -1448,13 +1452,14 @@
// ------------------------------------------------------------ Open inf window
function infopen() {
- var options="scrollbars=1,resizable=1,menubar=0,width=400,height=300";
- inf=open("","infout",options);
+ var iframe = parent.document.getElementById('infout');
+ inf = iframe.contentWindow;
}
// -------------------------------------------------------- Do inf status check
function infcheck() {
- if (inf.closed) {
+ var iframe = parent.document.getElementById('infout');
+ if (iframe.style.display == 'none') {
infopen();
}
}
@@ -1470,8 +1475,8 @@
infcheck();
inf.document.open();
inf.document.writeln(
- '<html><body bgcolor="#FFFFFF">'+
- '<table><tr><td width="32"><img src="'+raticons+'info.gif" /></td><td bgcolor="#AAFFAA">');
+ '<html><body style="background-color:white; margin: 0">'+
+ '<table style="font-size: 90%;"><tr><td width="32"><img src="'+raticons+'info.gif" /></td><td bgcolor="#AAFFAA">');
data1=infostr.split('&');
if (data1[0]=='c') {
inf.document.write('<b>Condition (');
@@ -1544,6 +1549,10 @@
}
inf.document.writeln('</td></tr></table></body></html>');
inf.document.close();
+ inf.opener = window;
+ var infout = parent.document.getElementById('infout')
+ infout.style.width = '500px';
+ infout.style.width = inf.document.body.firstChild.offsetWidth + 10 + 'px';
parent.top.focus();
parent.mapout.focus();
notclear=0;
@@ -1780,8 +1789,8 @@
infcheck();
inf.document.open();
inf.document.writeln(
- '<html><body bgcolor="#FFFFFF">'+
- '<table><tr><td width="32"><img src="'+raticons+'edit.gif" /></td><td bgcolor="#AAFFAA">');
+ '<html><body style="background-color:white; margin: 0">'+
+ '<table style="font-size: 90%;"><tr><td width="32"><img src="'+raticons+'edit.gif" /></td><td bgcolor="#AAFFAA">');
data1=infostr.split('&');
if (data1[0]=='c') {
inf.document.writeln('<b>Condition</b><hr />');
@@ -1937,6 +1946,10 @@
+'opener.infoclear();">Cancel</a>');
inf.document.writeln('</form></td></tr></table></body></html>');
inf.document.close();
+ inf.opener = window;
+ var infout = parent.document.getElementById('infout')
+ infout.style.width = '500px';
+ infout.style.width = inf.document.body.firstChild.offsetWidth + 10 + 'px';
inf.focus();
}
@@ -1952,8 +1965,8 @@
infcheck();
inf.document.open();
inf.document.writeln(
- '<html><body bgcolor="#FFFFFF">'+
- '<table><tr><td width="32"><img src="'+raticons+'edit.gif" /></td><td bgcolor="#AAFFAA">'+
+ '<html><body style="background-color:white; margin: 0">'+
+ '<table style="font-size: 90%;"><tr><td width="32"><img src="'+raticons+'edit.gif" /></td><td bgcolor="#AAFFAA">'+
'<b>Empty Field</b><hr />');
inf.document.writeln('<br /><a href="javascript:opener.newresource('+
@@ -2006,6 +2019,10 @@
+'opener.infoclear();">Cancel</a>');
inf.document.writeln('</td></tr></table></body></html>');
inf.document.close();
+ inf.opener = window;
+ var infout = parent.document.getElementById('infout')
+ infout.style.width = '500px';
+ infout.style.width = inf.document.body.firstChild.offsetWidth + 10 + 'px';
inf.focus();
}
@@ -2829,9 +2846,6 @@
// ---------------------------------------------------------- Close the window?
function leave() {
- if (!inf.closed) {
- inf.close();
- }
if (srch && !srch.closed) {
srchclose();
}
More information about the LON-CAPA-cvs
mailing list