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