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