made a copy
[atutor.git] / tools / tests / form_editor.php
1 <?php\r
2 /************************************************************************/\r
3 /* ATutor                                                                                                                               */\r
4 /************************************************************************/\r
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/\r
6 /* Adaptive Technology Resource Centre / University of Toronto                  */\r
7 /* http://atutor.ca                                                                                                             */\r
8 /*                                                                                                                                              */\r
9 /* This program is free software. You can redistribute it and/or                */\r
10 /* modify it under the terms of the GNU General Public License                  */\r
11 /* as published by the Free Software Foundation.                                                */\r
12 /************************************************************************/\r
13 // $Id$\r
14 \r
15 $page = 'form_editor';\r
16 define('AT_INCLUDE_PATH', '../../include/');\r
17 require(AT_INCLUDE_PATH.'vitals.inc.php');\r
18 \r
19 require(AT_INCLUDE_PATH.'lib/tinymce.inc.php');\r
20 \r
21 authenticate(AT_PRIV_TESTS);\r
22 \r
23 $area = $_GET['area'];\r
24 $number = null;\r
25 \r
26 $parts = explode('_', $area, 2);\r
27 if (is_numeric($parts[1])) {\r
28         $parts[1]++;\r
29         $title = _AT($parts[0]) . ' ' . $parts[1];\r
30 } else {\r
31         $title = _AT($area);\r
32 }\r
33 \r
34 $onload = 'onload="init();"';\r
35 \r
36 \r
37 global $myLang;\r
38 global $page;\r
39 global $savant;\r
40 global $errors, $onload;\r
41 global $_user_location;\r
42 global $_base_path;\r
43 global $cid;\r
44 global $contentManager;\r
45 global $_section;\r
46 global $addslashes;\r
47 \r
48 \r
49 if (defined('AT_FORCE_GET_FILE') && AT_FORCE_GET_FILE) {\r
50         $_tmp_base_href = AT_BASE_HREF . 'get.php/';\r
51 } else {\r
52         $_tmp_base_href = 'content/' . $_SESSION['course_id'] . '/';\r
53 }\r
54 \r
55 ?>\r
56 \r
57 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
58 <html lang="en">\r
59 <head>\r
60         <title><?php echo _AT('form_editor'); ?></title>\r
61 \r
62         <link rel="stylesheet" href="<?php echo $_base_path.'themes/'.$_SESSION['prefs']['PREF_THEME']; ?>/styles.css" type="text/css" />\r
63         <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />\r
64                 <base href="<?php echo AT_BASE_HREF; ?>" />\r
65 \r
66 </head>\r
67 \r
68 <body <?php echo $onload; ?> >\r
69 \r
70 <script type="text/javascript"><!--\r
71 function init() {\r
72         tinyMCE.activeEditor.setContent(window.opener.document.getElementById("<?php echo $area; ?>"). value);\r
73 }\r
74 //--></script>\r
75 \r
76 <?php load_editor(); ?>\r
77 \r
78 \r
79 <div align="right"><br /><a href="javascript:window.close()"><?php echo _AT('close_window'); ?></a></div>\r
80 <form name="form">\r
81         <table cellspacing="1" cellpadding="0" width="99%" border="0" class="bodyline" align="center" summary="">\r
82                 <tr>\r
83                         <th class="cyan"><?php echo $title; ?></th>\r
84                 </tr>\r
85                 <tr>\r
86                         <td colspan="2" valign="top" align="left" class="row1">\r
87                                 <table cellspacing="0" cellpadding="0" width="98%" border="0" summary="">\r
88                                 <tr>\r
89                                         <td class="row1" align="left">  \r
90                                                 <textarea name="body_text" id="body_text" rows="15" class="formfield" style="width: 99%;"></textarea>\r
91                                         </td>\r
92                                 </tr>\r
93                                 </table>\r
94                         </td>\r
95                 </tr>\r
96                 <tr>\r
97                         <td height="1" class="row2" colspan="2"></td>\r
98                 </tr>\r
99                 <tr>\r
100                         <td colspan="2" valign="top" align="center" class="row1">\r
101                                 <input type="button" name="paste"  value="<?php echo _AT('paste');  ?>" class="button" onclick="javascript:insertTo('<?php echo $area; ?>');" />\r
102                         </td>\r
103                 </tr>\r
104         </table>\r
105 </form>\r
106 <br />\r
107 \r
108 \r
109 <script type="text/javascript">\r
110 <!--\r
111 function insertTo(field) {\r
112                 if (window.opener.document.getElementById(field)) {\r
113                         //use the following if we want to apply absolute path.  -harris.\r
114                         //window.opener.document.getElementById(field).value = tinyMCE.activeEditor.getContent({format : 'raw'});\r
115                         window.opener.document.getElementById(field).value = tinyMCE.activeEditor.getContent();\r
116                 }\r
117 }\r
118 -->\r
119 </script>\r
120 \r
121 \r
122 <iframe src="<?php echo $_base_path; ?>tools/filemanager/index.php?framed=1<?php echo SEP; ?>popup=1" name="filemanager" width="98%" height="480">\r
123 </iframe>\r
124 \r
125 </body>\r
126 </html>