00001 <?php
00002
00011 class TKSnapHtmlEditor extends TKSnapEditor {
00021 protected function showEditor($cm, $failed) {
00022 if($failed)
00023 $content = $_REQUEST['editor'];
00024 else
00025 $content = $cm->getHTML();
00026 if(preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']))
00027 $whitespace = '';
00028 else
00029 $whitespace = 'whitespace: nowrap;';
00030 $html = "<form action=\"$_SERVER[REQUEST_URI]\" method=\"post\">
00031 <div style=\"text-align: center\">
00032 <textarea name=\"editor\" style=\"${whitespace}overflow: auto;\" rows=\"10\" cols=\"80\">" . htmlentities($content) . "</textarea><br />
00033 <input type=\"submit\" name=\"snap2ed_save\" value=\"Save\" />
00034 <input type=\"submit\" name=\"snap2ed_saveAndExit\" value=\"Save and Exit\" />
00035 <input type=\"submit\" name=\"snap2ed_exit\" value=\"Exit without Saving\" />
00036 </div>
00037 </form>
00038 <br />";
00039 $this->addText($html);
00040 }
00041
00050 protected function processSave($oldCM) {
00051 $content = $_REQUEST['editor'];
00052
00053 $cmNew = new SnapContentHtml($this->version);
00054 if(is_array($errors = $cmNew->setHTML($content))) {
00055 $html = "<p><b>Error:</b> Could not save document:</p>" . SXMLHelper::formatErrors($errors, true);
00056 $this->addText($html);
00057 return false;
00058 }
00059
00060 return $cmNew;
00061 }
00062 }
00063
00064 ?>