require(AT_INCLUDE_PATH.'vitals.inc.php');\r
require(AT_INCLUDE_PATH.'lib/filemanager.inc.php');\r
\r
+\r
if (!authenticate(AT_PRIV_FILES,AT_PRIV_RETURN)) {\r
authenticate(AT_PRIV_CONTENT);\r
}\r
}\r
\r
require(AT_INCLUDE_PATH.'header.inc.php');\r
+require(AT_INCLUDE_PATH.'lib/tinymce.inc.php');\r
+if (($_POST['setvisual'] && !$_POST['settext']) || $_GET['setvisual']) {\r
+ load_editor('body_text');\r
+}\r
+\r
+\r
?>\r
\r
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form">\r
<div class="row">\r
<h3><?php echo $file; ?></h3>\r
</div>\r
- \r
+ <div class="row">\r
+ <?php\r
+ if (($_POST['setvisual'] && !$_POST['settext']) || $_GET['setvisual']){\r
+ echo '<input type="hidden" name="setvisual" value="'.$_POST['setvisual'].'" />';\r
+ echo '<input type="submit" name="settext" value="'._AT('switch_text').'" />';\r
+ } else {\r
+ echo '<input type="submit" name="setvisual" value="'._AT('switch_visual').'" />';\r
+ }\r
+ ?>\r
+ </div>\r
<div class="row">\r
<label for="body_text"><?php echo _AT('body'); ?></label><br />\r
<textarea name="body_text" id="body_text" rows="25"><?php echo htmlspecialchars($_POST['body_text']); ?></textarea>\r
/* only html or txt extensions allowed */
if ($_POST['extension'] == 'html') {
$extension = 'html';
+ $head_html = "<html>\n<head>\n<title>".$_POST['filename']."</title>\n<head>\n<body>";
+ $foot_html ="\n</body>\n</html>";
} else {
$extension = 'txt';
}
if (!@file_exists($current_path.$pathext.$filename.'.'.$extension)) {
- $content = str_replace("\r\n", "\n", $_POST['body_text']);
+ $content = str_replace("\r\n", "\n", $head_html.$_POST['body_text'].$foot_html);
if (course_realpath($current_path . $pathext . $filename.'.'.$extension) == FALSE) {
$msg->addError('FILE_NOT_SAVED');
}
require(AT_INCLUDE_PATH.'header.inc.php');
+require(AT_INCLUDE_PATH.'lib/tinymce.inc.php');
+if (($_POST['setvisual'] && !$_POST['settext']) || $_GET['setvisual']) {
+ load_editor('body_text');
+}
+
$pathext = $_GET['pathext'];
$popup = $_GET['popup'];
$msg->printAll();
if (!$_POST['extension']) {
$_POST['extension'] = 'txt';
+ $_POST['formatting'] = 0;
+}else if($_POST['extension'] == "html"){
+ $_POST['formatting'] = 1;
}
?>
<input type="text" name="filename" id="ctitle" size="40" <?php if (isset($_POST['filename'])) echo 'value="'.$_POST['filename'].'"'?> />
</div>
- <div class="row">
- <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><?php echo _AT('type'); ?><br />
- <input type="radio" name="extension" value="txt" id="text" <?php if ($_POST['extension'] == 'txt') { echo 'checked="checked"'; } ?> />
- <label for="text"><?php echo _AT('text'); ?></label>
+<div class="row">
- <input type="radio" name="extension" value="html" id="html" <?php if ($_POST['extension'] == 'html') { echo 'checked="checked"'; } ?> />
- <label for="html"><?php echo _AT('html'); ?></label>
- </div>
+ <div class="required" title="<?php echo _AT('required_field'); ?>">*</div><?php echo _AT('type'); ?><br />
+ <input type="radio" name="extension" value="txt" id="text" <?php if ($_POST['formatting'] == 0) { echo 'checked="checked"'; } ?> onclick="javascript: document.form.setvisual.disabled=true;" <?php if ($_POST['setvisual'] && !$_POST['settext']) { echo 'disabled="disabled"'; } ?> />
+ <label for="text"><?php echo _AT('plain_text'); ?></label>
+
+ , <input type="radio" name="extension" value="html" id="html" <?php if ($_POST['formatting'] ==1 || $_POST['setvisual']) { echo 'checked="checked"'; } ?> onclick="javascript: document.form.setvisual.disabled=false;"/>
+ <label for="html"><?php echo _AT('html'); ?></label>
+ <?php if (($_POST['setvisual'] && !$_POST['settext']) || $_GET['setvisual']) : ?>
+ <input type="hidden" name="setvisual" value="<?php echo $_POST['setvisual']; ?>" />
+ <input type="submit" name="settext" value="<?php echo _AT('switch_text'); ?>" />
+ <?php else: ?>
+ <input type="submit" name="setvisual" value="<?php echo _AT('switch_visual'); ?>" <?php if ($_POST['formatting']==0) { echo 'disabled="disabled"'; } ?> />
+ <?php endif; ?>
+ </div>
<div class="row">
<label for="body_text"><?php echo _AT('body'); ?></label><br />
<textarea name="body_text" id="body_text" rows="25"><?php echo ContentManager::cleanOutput($_POST['body_text']); ?></textarea>