remove old readme
[atutor.git] / docs / mods / _standard / tests / form_editor.php
1 <?php\r
2 /************************************************************************/\r
3 /* ATutor                                                                                                                               */\r
4 /************************************************************************/\r
5 /* Copyright (c) 2002-2010                                              */\r
6 /* Inclusive Design Institute                                           */\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=UTF-8" />\r
64         <base href="<?php echo AT_BASE_HREF; ?>" />\r
65         <script src="<?php echo $_base_path; ?>jscripts/infusion/InfusionAll.js" type="text/javascript"></script>\r
66         <script src="<?php echo $_base_path; ?>jscripts/ATutor.js" type="text/javascript"></script>\r
67 \r
68 </head>\r
69 \r
70 <body <?php echo $onload; ?> >\r
71 \r
72 <script type="text/javascript"><!--\r
73 function init() {\r
74         tinyMCE.activeEditor.setContent(window.opener.document.getElementById("<?php echo $area; ?>"). value);\r
75 }\r
76 //--></script>\r
77 \r
78 <?php load_editor(); ?>\r
79 \r
80 \r
81 <div align="right"><br /><a href="javascript:window.close()"><?php echo _AT('close_window'); ?></a></div>\r
82 <form name="form">\r
83         <table cellspacing="1" cellpadding="0" width="99%" border="0" class="bodyline" align="center" summary="">\r
84                 <tr>\r
85                         <th class="cyan"><?php echo $title; ?></th>\r
86                 </tr>\r
87                 <tr>\r
88                         <td colspan="2" valign="top" align="left" class="row1">\r
89                                 <table cellspacing="0" cellpadding="0" width="98%" border="0" summary="">\r
90                                 <tr>\r
91                                         <td class="row1" align="left">  \r
92                                                 <textarea name="body_text" id="body_text" rows="15" class="formfield" style="width: 99%;"></textarea>\r
93                                         </td>\r
94                                 </tr>\r
95                                 </table>\r
96                         </td>\r
97                 </tr>\r
98                 <tr>\r
99                         <td height="1" class="row2" colspan="2"></td>\r
100                 </tr>\r
101                 <tr>\r
102                         <td colspan="2" valign="top" align="center" class="row1">\r
103                                 <input type="button" name="paste"  value="<?php echo _AT('paste');  ?>" class="button" onclick="javascript:insertTo('<?php echo $area; ?>');" />\r
104                         </td>\r
105                 </tr>\r
106         </table>\r
107 </form>\r
108 <br />\r
109 \r
110 \r
111 <script type="text/javascript">\r
112 <!--\r
113 function insertTo(field) {\r
114                 if (window.opener.document.getElementById(field)) {\r
115                         //use the following if we want to apply absolute path.  -harris.\r
116                         //window.opener.document.getElementById(field).value = tinyMCE.activeEditor.getContent({format : 'raw'});\r
117                         window.opener.document.getElementById(field).value = tinyMCE.activeEditor.getContent();\r
118                 }\r
119 }\r
120 -->\r
121 </script>\r
122 \r
123 \r
124 <iframe src="<?php echo $_base_path; ?>mods/_core/file_manager/index.php?framed=1<?php echo SEP; ?>popup=1" name="filemanager" width="98%" height="480">\r
125 </iframe>\r
126 \r
127 </body>\r
128 </html>