00001 <?php
00002
00011 class TKSnapCssEditor 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\">$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 SnapContentCss($this->version);
00054 if(!$cmNew->setCSS($content)) {
00055 $html = "<p><b>Error:</b> Could not save document:</p><ul><li>" . implode("</li><li>", $cmNew->getLastError())
00056 . "</li></ul>";
00057 $this->addText($html);
00058 return false;
00059 }
00060
00061 return $cmNew;
00062 }
00063 }
00064
00065 ?>