-<?php\r
- include("../../../config.php");\r
-?>\r
-<html>\r
-<head><title>Fullscreen Editor</title>\r
-<style type="text/css">\r
-@import url(../htmlarea.css);\r
-html, body { margin: 0px; border: 0px; background-color: buttonface; } </style>\r
-\r
-\r
-<script type="text/javascript" src="../htmlarea.php<?php print($id != "")?"?id=$id":"";?>"></script>\r
-<script type="text/javascript" src="../lang/en.php"></script>\r
-<script type="text/javascript" src="../dialog.js"></script>\r
-\r
-<script type="text/javascript">\r
-// load same scripts that were present in the opener page\r
-var scripts = opener.document.getElementsByTagName("script");\r
-var head = document.getElementsByTagName("head")[0];\r
-for (var i = 0; i < scripts.length; ++i) {\r
- var script = scripts[i];\r
- if (typeof script.src != "undefined" && /\S/.test(script.src)) {\r
- // document.write("<scr" + "ipt type=" + "\"script/javascript\"");\r
- // document.write(" src=\"../" + script.src + "\"></scr" + "ipt>");\r
- var new_script = document.createElement("script");\r
- if (/^http:/i.test(script.src)) {\r
- new_script.src = script.src;\r
- } else {\r
- new_script.src = "../" + script.src;\r
- }\r
- head.appendChild(new_script);\r
- }\r
-}\r
-</script>\r
-\r
-<script type="text/javascript">\r
-\r
-var parent_object = null;\r
-var editor = null; // to be initialized later [ function init() ]\r
-\r
-/* ---------------------------------------------------------------------- *\\r
- Function : \r
- Description : \r
-\* ---------------------------------------------------------------------- */\r
-\r
-function _CloseOnEsc(ev) {\r
- if (document.all) {\r
- // IE\r
- ev = window.event;\r
- }\r
- if (ev.keyCode == 27) {\r
- // update_parent();\r
- window.close();\r
- return;\r
- }\r
-}\r
-\r
-/* ---------------------------------------------------------------------- *\\r
- Function : cloneObject\r
- Description : copy an object by value instead of by reference\r
- Usage : var newObj = cloneObject(oldObj);\r
-\* ---------------------------------------------------------------------- */\r
-\r
-function cloneObject(obj) {\r
- var newObj = new Object; \r
-\r
- // check for array objects\r
- if (obj.constructor.toString().indexOf("function Array(") == 1) {\r
- newObj = obj.constructor();\r
- }\r
-\r
- // check for function objects (as usual, IE is fucked up)\r
- if (obj.constructor.toString().indexOf("function Function(") == 1) {\r
- newObj = obj; // just copy reference to it\r
- } else for (var n in obj) {\r
- var node = obj[n];\r
- if (typeof node == 'object') { newObj[n] = cloneObject(node); }\r
- else { newObj[n] = node; }\r
- }\r
- \r
- return newObj;\r
-}\r
-\r
-/* ---------------------------------------------------------------------- *\\r
- Function : resize_editor\r
- Description : resize the editor when the user resizes the popup\r
-\* ---------------------------------------------------------------------- */\r
-\r
-function resize_editor() { // resize editor to fix window\r
- var newHeight;\r
- if (document.all) {\r
- // IE\r
- newHeight = document.body.offsetHeight - editor._toolbar.offsetHeight;\r
- if (newHeight < 0) { newHeight = 0; }\r
- } else {\r
- // Gecko\r
- newHeight = window.innerHeight - editor._toolbar.offsetHeight;\r
- }\r
- if (editor.config.statusBar) {\r
- newHeight -= editor._statusBar.offsetHeight;\r
- }\r
- editor._textArea.style.height = editor._iframe.style.height = newHeight + "px";\r
-}\r
-\r
-/* ---------------------------------------------------------------------- *\\r
- Function : init\r
- Description : run this code on page load\r
-\* ---------------------------------------------------------------------- */\r
-\r
-function init() {\r
- parent_object = opener.HTMLArea._object;\r
- var config = cloneObject( parent_object.config );\r
- config.editorURL = "../";\r
- config.width = "100%";\r
- config.height = "auto";\r
-\r
- // change maximize button to minimize button\r
- config.btnList["popupeditor"] = [ 'Minimize Editor', '<?php echo $CFG->wwwroot ?>/lib/editor/images/fullscreen_minimize.gif', true,\r
- function() { window.close(); } ];\r
-\r
- // generate editor and resize it\r
- editor = new HTMLArea("editor", config);\r
- editor.generate();\r
- editor._iframe.style.width = "100%";\r
- editor._textArea.style.width = "100%";\r
- resize_editor();\r
-\r
- // set child window contents and event handlers, after a small delay\r
- setTimeout(function() {\r
- editor.setHTML(parent_object.getInnerHTML());\r
-\r
- // switch mode if needed\r
- if (parent_object._mode == "textmode") { editor.setMode("textmode"); }\r
-\r
- // continuously update parent editor window\r
- setInterval(update_parent, 500);\r
-\r
- // setup event handlers\r
- document.body.onkeypress = _CloseOnEsc;\r
- editor._doc.body.onkeypress = _CloseOnEsc;\r
- editor._textArea.onkeypress = _CloseOnEsc;\r
- window.onresize = resize_editor;\r
- }, 333); // give it some time to meet the new frame\r
-}\r
-\r
-/* ---------------------------------------------------------------------- *\\r
- Function : update_parent\r
- Description : update parent window editor field with contents from child window\r
-\* ---------------------------------------------------------------------- */\r
-\r
-function update_parent() {\r
- // use the fast version\r
- parent_object.setHTML(editor.getInnerHTML());\r
-}\r
-\r
-\r
-</script>\r
-</head>\r
-<body scroll="no" onload="init()" onunload="update_parent()">\r
-\r
-<form style="margin: 0px; border: 1px solid; border-color: threedshadow threedhighlight threedhighlight threedshadow;">\r
-<textarea name="editor" id="editor" style="width:100%; height:300px"> </textarea>\r
-</form>\r
-\r
-</body></html>\r
+<?php // $Id$
+ include("../../../config.php");
+?>
+<html>
+<head><title>Fullscreen Editor</title>
+<style type="text/css">
+@import url(../htmlarea.css);
+html, body { margin: 0px; border: 0px; background-color: buttonface; } </style>
+
+
+<script type="text/javascript" src="../htmlarea.php<?php print($id != "")?"?id=$id":"";?>"></script>
+<script type="text/javascript" src="../lang/en.php"></script>
+<script type="text/javascript" src="../dialog.js"></script>
+<script type="text/javascript" src="../plugins/TableOperations/table-operations.js"></script>
+<script type="text/javascript" src="../plugins/TableOperations/lang/en.js"></script>
+<script type="text/javascript">
+// load same scripts that were present in the opener page
+var scripts = opener.document.getElementsByTagName("script");
+var head = document.getElementsByTagName("head")[0];
+for (var i = 0; i < scripts.length; ++i) {
+ var script = scripts[i];
+ if (typeof script.src != "undefined" && /\S/.test(script.src)) {
+ // document.write("<scr" + "ipt type=" + "\"script/javascript\"");
+ // document.write(" src=\"../" + script.src + "\"></scr" + "ipt>");
+ var new_script = document.createElement("script");
+ if (/^http:/i.test(script.src)) {
+ new_script.src = script.src;
+ } else {
+ new_script.src = "../" + script.src;
+ }
+ head.appendChild(new_script);
+ }
+}
+</script>
+
+<script type="text/javascript">
+
+var parent_object = null;
+var editor = null; // to be initialized later [ function init() ]
+
+/* ---------------------------------------------------------------------- *\
+ Function :
+ Description :
+\* ---------------------------------------------------------------------- */
+
+function _CloseOnEsc(ev) {
+ if (document.all) {
+ // IE
+ ev = window.event;
+ }
+ if (ev.keyCode == 27) {
+ // update_parent();
+ window.close();
+ return;
+ }
+}
+
+/* ---------------------------------------------------------------------- *\
+ Function : cloneObject
+ Description : copy an object by value instead of by reference
+ Usage : var newObj = cloneObject(oldObj);
+\* ---------------------------------------------------------------------- */
+
+function cloneObject(obj) {
+ var newObj = new Object;
+
+ // check for array objects
+ if (obj.constructor.toString().indexOf("function Array(") == 1) {
+ newObj = obj.constructor();
+ }
+
+ // check for function objects (as usual, IE is fucked up)
+ if (obj.constructor.toString().indexOf("function Function(") == 1) {
+ newObj = obj; // just copy reference to it
+ } else for (var n in obj) {
+ var node = obj[n];
+ if (typeof node == 'object') { newObj[n] = cloneObject(node); }
+ else { newObj[n] = node; }
+ }
+
+ return newObj;
+}
+
+/* ---------------------------------------------------------------------- *\
+ Function : resize_editor
+ Description : resize the editor when the user resizes the popup
+\* ---------------------------------------------------------------------- */
+
+function resize_editor() { // resize editor to fix window
+ var newHeight;
+ if (document.all) {
+ // IE
+ newHeight = document.body.offsetHeight - editor._toolbar.offsetHeight;
+ if (newHeight < 0) { newHeight = 0; }
+ } else {
+ // Gecko
+ newHeight = window.innerHeight - editor._toolbar.offsetHeight;
+ }
+ if (editor.config.statusBar) {
+ newHeight -= editor._statusBar.offsetHeight;
+ }
+ editor._textArea.style.height = editor._iframe.style.height = newHeight + "px";
+}
+
+/* ---------------------------------------------------------------------- *\
+ Function : init
+ Description : run this code on page load
+\* ---------------------------------------------------------------------- */
+
+function init() {
+ parent_object = opener.HTMLArea._object;
+ var config = cloneObject( parent_object.config );
+ config.editorURL = "../";
+ config.width = "100%";
+ config.height = "auto";
+
+ // change maximize button to minimize button
+ config.btnList["popupeditor"] = [ 'Minimize Editor', '<?php echo $CFG->wwwroot ?>/lib/editor/images/fullscreen_minimize.gif', true,
+ function() { window.close(); } ];
+
+ // generate editor and resize it
+ editor = new HTMLArea("editor", config);
+ editor.registerPlugin(TableOperations);
+ editor.generate();
+ editor._iframe.style.width = "100%";
+ editor._textArea.style.width = "100%";
+ resize_editor();
+
+ // set child window contents and event handlers, after a small delay
+ setTimeout(function() {
+ editor.setHTML(parent_object.getInnerHTML());
+
+ // switch mode if needed
+ if (parent_object._mode == "textmode") { editor.setMode("textmode"); }
+
+ // continuously update parent editor window
+ setInterval(update_parent, 500);
+
+ // setup event handlers
+ document.body.onkeypress = _CloseOnEsc;
+ editor._doc.body.onkeypress = _CloseOnEsc;
+ editor._textArea.onkeypress = _CloseOnEsc;
+ window.onresize = resize_editor;
+ }, 333); // give it some time to meet the new frame
+}
+
+/* ---------------------------------------------------------------------- *\
+ Function : update_parent
+ Description : update parent window editor field with contents from child window
+\* ---------------------------------------------------------------------- */
+
+function update_parent() {
+ // use the fast version
+ parent_object.setHTML(editor.getInnerHTML());
+}
+
+
+</script>
+</head>
+<body scroll="no" onload="init()" onunload="update_parent()">
+
+<form style="margin: 0px; border: 1px solid; border-color: threedshadow threedhighlight threedhighlight threedshadow;">
+<textarea name="editor" id="editor" style="width:100%; height:300px"> </textarea>
+</form>
+
+</body></html>