moved code up one level to eliminate the docs subdirectory
[acontent.git] / home / editor / editor_tabs / edit.inc.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 if (!defined('TR_INCLUDE_PATH')) { exit; }\r
14 global $_course_id;\r
15 ?>\r
16     <script type="text/javascript" language="javascript">\r
17     //<!--\r
18         //trans.editor.editor_pref = "<?php if(isset($_SESSION['prefs']['PREF_CONTENT_EDITOR'])) echo $_SESSION['prefs']['PREF_CONTENT_EDITOR'] ?>";\r
19     //-->\r
20     </script>\r
21     <input type="hidden" name="displayhead" id="displayhead" value="<?php if ($_POST['displayhead']==1 || $_REQUEST['displayhead']==1 || $_GET['displayhead']==1) echo '1'; else echo '0'; ?>" />\r
22     <input type="hidden" name="displaypaste" id="displaypaste" value="<?php if ($_POST['displaypaste']==1 || $_REQUEST['displaypaste']==1 || $_GET['displaypaste']==1) echo '1'; else echo '0'; ?>" />\r
23     <input type="hidden" name="complexeditor" id="complexeditor" value="<?php if ($_POST['complexeditor']==1 || $_REQUEST['complexeditor']==1 || $_GET['complexeditor']==1) echo '1'; else echo '0'; ?>" />\r
24 \r
25         <div class="row">\r
26             <span>\r
27                 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="ctitle"><strong><?php echo _AT('title');  ?></strong></label>\r
28                 <input type="text" name="title" id="ctitle" size="60" class="formfield" value="<?php echo ContentManager::cleanOutput($_POST['title']); ?>" />\r
29         </span>\r
30         <span class="nowrap">\r
31         <label for="formatting_radios"><span class="required" title="<?php echo _AT('required_field'); ?>">*</span><strong><?php echo _AT('formatting'); ?></strong></label>\r
32         <span class="bordered" id="formatting_radios">\r
33             <input type="radio" name="formatting" value="0" id="text" <?php if ($_POST['formatting'] == 0) { echo 'checked="checked"'; } ?> />\r
34             <label for="text"><?php echo _AT('plain_text'); ?></label>\r
35 \r
36             <input type="radio" name="formatting" value="1" id="html" <?php if ($_POST['formatting'] == 1) { echo 'checked="checked"'; } ?> />\r
37             <label for="html"><?php echo _AT('html'); ?></label>\r
38        \r
39             <input type="radio" name="formatting" value="2" id="weblink" <?php if ($_POST['formatting'] == 2) { echo 'checked="checked"'; } ?> />\r
40             <label for="weblink"><?php echo _AT('weblink'); ?></label>\r
41        </span>\r
42        </span>\r
43     </div>\r
44 \r
45 <?php\r
46                 if ($content_row['content_path']) {\r
47                         echo '  <div class="row"><strong>'._AT('packaged_in').':</strong>&nbsp;&nbsp;'.$content_row['content_path'].'</div>';\r
48                 }\r
49         if (trim($_POST['head']) == '<br />') {\r
50               $_POST['head'] = '';\r
51         }\r
52         if ($do_check) {\r
53                $_POST['head'] = $stripslashes($_POST['head']);\r
54         }\r
55 ?>\r
56     <script type="text/javascript" language="javascript">\r
57     //<!--\r
58         trans.editor.content_path = "<?php if(isset($content_row['content_path'])) echo $content_row['content_path']; ?>";\r
59         trans.editor.course_id = "<?php if(isset($cid)) echo $_course_id; ?>";\r
60         trans.editor.content_id = "<?php if(isset($cid)) echo $cid; ?>";\r
61         trans.editor.head_enabled_title = "<?php echo _AT('customized_head_enabled_title'); ?>";\r
62         trans.editor.head_disabled_title = "<?php echo _AT('customized_head_disabled_title'); ?>";\r
63         trans.editor.paste_enabled_title = "<?php echo _AT('paste_enabled_title'); ?>";\r
64         trans.editor.paste_disabled_title = "<?php echo _AT('paste_disabled_title'); ?>";\r
65         trans.editor.fileman_enabled_title = "<?php echo _AT('fileman_enabled_title').' - '._AT('new_window'); ?>";\r
66         trans.editor.fileman_disabled_title = "<?php echo _AT('fileman_disabled_title'); ?>";\r
67         trans.editor.accessibility_enabled_title = "<?php echo _AT('accessibility_enabled').' - '._AT('new_window'); ?>";\r
68         trans.editor.accessibility_disabled_title = "<?php echo _AT('accessibility_disabled'); ?>";\r
69         trans.editor.processing_text = "<?php echo _AT('processing'); ?>";\r
70         trans.base_href = "<?php echo TR_BASE_HREF; ?>";\r
71     //-->\r
72     </script>\r
73     \r
74     <div class="row fl-container fl-fix">\r
75       <ul id="content-tool-links">\r
76         <li><img id="previewtool" class="fl-col clickable" src="<?php echo TR_BASE_HREF.'images/preview.png'?>" title="<?php echo _AT('preview').' - '._AT('new_window'); ?>" alt="<?php echo _AT('preview').' - '._AT('new_window'); ?>" height="30" width="30" /><?php echo _AT('preview'); ?></li>\r
77         <li><img id="accessibilitytool" class="fl-col" src="" title="" alt="" height="30" width="30" /><?php echo _AT('accessibility'); ?></li>\r
78         <li><img id="headtool" class="fl-col" src="" title="" alt="" height="30" width="30" /><?php echo _AT('customized_head'); ?></li>\r
79         <li><img id="pastetool" class="fl-col" title="" src="" alt="" height="30" width="30"/><?php echo _AT('paste'); ?></li>\r
80         <li><img id="filemantool" class="fl-col" title="" src="" alt="" height="30" width="30" /><?php echo _AT('files'); ?></li>\r
81            \r
82 <!-- ******** Tool Manager ******* \r
83 <?php\r
84 /*\r
85         $count = 0;\r
86     foreach($all_tools as $tool) {\r
87         if($tool['tool_file'] != '' && $tool['table'] != '') {\r
88             $sql_assoc = "SELECT * FROM ".TABLE_PREFIX.$tool['table']." WHERE content_id='$cid'";\r
89             $tool_row = $dao->execute($sql_assoc);\r
90             if (is_array($tool_row)) $num_row = count($tool_row);\r
91 \r
92             if($num_row > 0){\r
93                 $tool['alt'] = $tool['title'].' '._AT('added');\r
94             } else {\r
95                 $tool['alt'] = $tool['title'].' '._AT('none');\r
96             }\r
97 \r
98             $count++; \r
99 ?>\r
100             <!-- TODO LAW note problem here with one tool_file variable for multiple tools -->\r
101                 <script type="text/javascript" language="javascript">\r
102                 //<!--\r
103                 trans.editor.tool_file = "<?php if(isset($tool['tool_file'])) echo $tool['tool_file'] ?>";\r
104                 //-->\r
105                 </script>\r
106                 <img class="fl-col clickable tool" src="<?php echo $tool['img']; ?>" alt="<?php echo $tool['alt']; ?>" title="<?php echo $tool['title']; ?>" height="30" width="30" />\r
107 <?php \r
108         }\r
109     }\r
110     */\r
111 ?>\r
112 ****** end Tool Manager ***** -->\r
113           </ul>\r
114         </div> <!-- end toolbar -->\r
115 \r
116         <!-- Customized head -->\r
117         <div id="head" class="row fl-fix">\r
118         <label for="headtext"><?php echo _AT('customized_head');  ?>\r
119         <small>(<?php echo _AT('customized_head_note'); ?>)</small></label>\r
120         <input type="checkbox" name="use_customized_head" id="use_customized_head" value="1" <?php if ($_POST['use_customized_head']) { echo 'checked="checked"'; } ?> />\r
121         <label for="use_customized_head"><?php echo _AT('use_customized_head'); ?></label>\r
122                 <textarea id="headtext" name="head" cols="" rows="10"><?php echo htmlspecialchars($_POST['head']); ?></textarea>        \r
123         </div>\r
124                 \r
125     <!-- Paste from file -->\r
126         <div id="paste" class="row">\r
127         <div><?php echo _AT('paste_file')?><small>(<?php echo _AT('html_only'); ?>)</small></div>\r
128         <input title="<?php echo _AT('browse_for_upload'); ?>" type="file" name="uploadedfile_paste" id="uploadedfile" class="formfield" size="20" /> \r
129         <input type="submit" name="submit_file" value="<?php echo _AT('upload'); ?>"  class="button" />\r
130     </div>\r
131    \r
132     <?php \r
133         // kludge #1548\r
134         if (trim($_POST['body_text']) == '<br />') {\r
135                $_POST['body_text'] = '';\r
136         }\r
137         if ($do_check) {\r
138                $_POST['body_text'] = $stripslashes($_POST['body_text']);\r
139         }\r
140     ?>\r
141 \r
142     <div class="row">\r
143         <span id="textSpan">\r
144             <label for="body_text"><strong><?php echo _AT('body');  ?></strong></label>\r
145                     <textarea name="body_text" id="body_text" cols="" rows="20"><?php echo htmlspecialchars($_POST['body_text']);?></textarea>\r
146                 </span>\r
147                 <span id="weblinkSpan"> \r
148                 <label for="weblink_text"><?php echo _AT('weblink');  ?></label>\r
149             <input name="weblink_text" id="weblink_text" value="<?php echo ($_POST['weblink_text']!=''?htmlspecialchars($_POST['weblink_text']):'http://'); ?>" />\r
150                 </span>\r
151         </div>\r
152 \r