From: Yves K. <yku...@us...> - 2004-11-07 00:31:01
|
Update of /cvsroot/phpwebsite-comm/modules/xwysiwyg/mod/xwysiwyg/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30937/modules/xwysiwyg/mod/xwysiwyg/class Modified Files: xwysiwyg.php Log Message: bugfix for notice: undefined variables bugfixes for answer-array bugfix phpsniffer was not working properly optical: simplified javascript-creation Index: xwysiwyg.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/xwysiwyg/mod/xwysiwyg/class/xwysiwyg.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** xwysiwyg.php 6 Nov 2004 19:23:28 -0000 1.10 --- xwysiwyg.php 7 Nov 2004 00:29:41 -0000 1.11 *************** *** 47,51 **** require_once(PHPWS_SOURCE_DIR.'mod/xwysiwyg/class/phpSniff.class.php');//include the browser checking code //First thing, check browser version. Since I haven't tested, you'll have to add a better list of supported browsers ! $client =& new phpSniff($GET_VARS['UA']); //Now we want an inclusion list of browsers. These browsers are supposed to work, Galleon or aol versions $browsers = array("fb.6+", "NS7+","ie5.5+","mz1.3+","op7+","kq3+","ga","aol","ca"); --- 47,51 ---- require_once(PHPWS_SOURCE_DIR.'mod/xwysiwyg/class/phpSniff.class.php');//include the browser checking code //First thing, check browser version. Since I haven't tested, you'll have to add a better list of supported browsers ! $client =& new phpSniff();//$GET_VARS['UA']); //Now we want an inclusion list of browsers. These browsers are supposed to work, Galleon or aol versions $browsers = array("fb.6+", "NS7+","ie5.5+","mz1.3+","op7+","kq3+","ga","aol","ca"); *************** *** 53,57 **** if($client->browser_is($search)) $supported = TRUE; } - $settings = PHPWS_xwysiwyg::readConfig(); $allowed = FALSE; --- 53,56 ---- *************** *** 61,75 **** if((!$supported)OR(!$allowed)) { ! $answer[xwysiwyg] = FALSE; ! $answer[onRequest] = FALSE; ! $answer[xwButton] = FALSE; } elseif($settings['request_mode']) { ! $answer[xwysiwyg] = TRUE; ! $answer[onRequest] = TRUE; ! $answer[xwButton] = TRUE; } else { ! $answer[xwysiwyg] = PHPWS_xwysiwyg::isBox($section_name); ! $answer[onRequest] = FALSE; ! $answer[xwButton] = $_SESSION["OBJ_user"]->allow_access("xwysiwyg","settings"); } return $answer; --- 60,74 ---- if((!$supported)OR(!$allowed)) { ! $answer["xwysiwyg"] = FALSE; ! $answer["onRequest"] = FALSE; ! $answer["xwButton"] = FALSE; } elseif($settings['request_mode']) { ! $answer["xwysiwyg"] = TRUE; ! $answer["onRequest"] = TRUE; ! $answer["xwButton"] = TRUE; } else { ! $answer["xwysiwyg"] = PHPWS_xwysiwyg::isBox($section_name); ! $answer["onRequest"] = FALSE; ! $answer["xwButton"] = $_SESSION["OBJ_user"]->allow_access("xwysiwyg","settings"); } return $answer; *************** *** 124,200 **** } ! function makeEditors($settings,$index,$regplugs,$area,$lang) { // HtmlArea - Editor - Section ! if($settings['editor']=="htmlarea") { ! if($index==1){ ! if($settings['request_mode']) { // 1. HtmlArea Editor in Request-Mode ! $editors .= " ! function initEditor$index() { ! var editor$index = new HTMLArea(\"$area\"); ! ".$regplugs." ! editor$index.config.height = \"300px\"; ! editor$index.config.pageStyle = \"@import url('".PHPWS_xwysiwyg::pickCSS()."');\"; ! editor$index.generate(); ! return false; ! } ! "; ! } else { // 1. HtmlArea Editor in Normal-Mode ! $editors .= " ! var editor$index = new HTMLArea(\"$area\"); ! ".$regplugs." ! editor$index.config.height = \"300px\"; ! editor$index.config.pageStyle = \"@import url('".PHPWS_xwysiwyg::pickCSS()."');\"; ! editor$index.generate(); ! "; ! } ! } else { ! if($settings['request_mode']) { // 2. HtmlArea Editor in Request-Mode ! $editors .= " ! function initEditor$index() { ! var editor$index = new HTMLArea(\"$area\"); ! ".$regplugs." ! editor$index.config.height = \"300px\"; ! editor$index.config.pageStyle = \"@import url('".PHPWS_xwysiwyg::pickCSS()."');\"; ! editor$index.generate(); ! return false; ! } ! "; ! } else { // 2. HtmlArea Editor in Normal-Mode ! $editors .= " ! var editor$index = new HTMLArea(\"$area\"); ! ".$regplugs." ! editor$index.config.height = \"300px\"; ! editor$index.config.pageStyle = \"@import url('".PHPWS_xwysiwyg::pickCSS()."');\"; ! setTimeout(function() { ! editor$index.generate(); ! }, 900); ! "; ! } ! } ! } else if($settings['editor']=="fck") { // FCKeditor - Editor - Section ! $skin = $settings['fck_skin']; ! if($settings['request_mode']) { // FCK Editor in Request-Mode ! $editors .= "\n function initEditor$index() {\n"; } ! $editors .= " ! var editor$index = new FCKeditor(\"$area\"); ! editor$index.BasePath = \"http://".PHPWS_SOURCE_HTTP."mod/xwysiwyg/_fck/\" ; ! editor$index.CheckBrowser = false ; ! editor$index.Config[\"AutoDetectLanguage\"] = false ; ! editor$index.Config[\"EditorAreaCSS\"] = \"".PHPWS_xwysiwyg::pickCSS()."\"; ! editor$index.Config[\"DefaultLanguage\"] = \"$lang\" ; ! editor$index.Config[\"SkinPath\"] = \"skins/$skin/\" ; ! ".$regplugs; ! if($index==1){ // Ending for 1. Editor ! $editors .= " ! editor$index.ReplaceTextarea();"; ! } else { // Ending for further Editors ! $editors .= " ! setTimeout(function() { ! editor$index.ReplaceTextarea(); ! }, 400);"; ! } ! if($settings['request_mode']) { // Close FCK Editor in Request-Mode ! $editors .= "\n return false;\n }\n"; } } return $editors; --- 123,154 ---- } ! function makeEditors($settings,$index,$regplugs,$area,$lang) { // Editor - Section ! if($settings['editor']=="htmlarea") { // HtmlArea in Normal-Mode ! $editors = " ! var editor$index = new HTMLArea(\"$area\"); ! ".$regplugs." ! editor$index.config.height = \"300px\"; ! editor$index.config.pageStyle = \"@import url('".PHPWS_xwysiwyg::pickCSS()."');\"; ! setTimeout(function() { editor$index.generate(); }, ".($index*300).");"; ! if($settings['request_mode']) // HtmlArea Editor in Request-Mode ! $editors = "\n function initEditor$index() { \n".$editors."\n return false;\n }\n"; ! } else if($settings['editor']=="fck") { // FCKeditor in Normal-Mode ! $skin = $settings['fck_skin']; ! $editors = " ! var editor$index = new FCKeditor(\"$area\"); ! editor$index.BasePath = \"http://".PHPWS_SOURCE_HTTP."mod/xwysiwyg/_fck/\" ; ! editor$index.CheckBrowser = false ; ! editor$index.Config[\"AutoDetectLanguage\"] = false ; ! editor$index.Config[\"EditorAreaCSS\"] = \"".PHPWS_xwysiwyg::pickCSS()."\"; ! editor$index.Config[\"DefaultLanguage\"] = \"$lang\" ; ! editor$index.Config[\"SkinPath\"] = \"skins/$skin/\" ; ! ".$regplugs." ! setTimeout(function() { editor$index.ReplaceTextarea(); }, ".($index*200).");"; ! ! if($settings['request_mode']) { // FCKeditor in Request-Mode ! $editors = "\n function initEditor$index() {\n".$editors. ! "\n return false;\n }\n"; } } return $editors; *************** *** 202,205 **** --- 156,161 ---- function makeMain($settings,$editors,$loadplugs,$lang) { + $scriptHeader = "<script type=\"text/javascript\">\n//<![CDATA[\n"; + $scriptFooter = "//]]>\n</script>\n"; if($settings['editor']=="htmlarea") { // start cookie-code from chrisbarc *************** *** 215,262 **** // HtmlArea-Main for all Modes ! $main = " ! <script type=\"text/javascript\">\n//<![CDATA[ ! _editor_lang = \"".$lang."\"; _editor_url = \"http://".PHPWS_SOURCE_HTTP."mod/xwysiwyg/_htmlarea/\"; ! //]]>\n</script> <!-- load the main HTMLArea files --> <script type=\"text/javascript\" src=\"http://".PHPWS_SOURCE_HTTP."mod/xwysiwyg/_htmlarea/htmlarea.js\"></script> ! <script type=\"text/javascript\">\n//<![CDATA[ ! ".$loadplugs; ! ! if($settings['request_mode']) { // HtmlArea-Main in Request-Mode ! $main .= " $editors ! //]]>\n</script> ! "; ! } else { // HtmlArea-Main in Normal-Mode ! $main .= " window.onload = function initEditor() { // create the editor(s) for the related textbox(es) ! $editors ! return false; ! } ! //]]>\n</script> ! "; ! } } else if($settings['editor']=="fck") { // FCK-Main for all Modes ! $main = " <!-- load the main FCKeditor files --> <script type=\"text/javascript\" src=\"http://".PHPWS_SOURCE_HTTP."mod/xwysiwyg/_fck/fckeditor.js\"></script> ! <script type=\"text/javascript\">\n//<![CDATA[ ! ".$loadplugs; ! if($settings['request_mode']) { // FCK-Main in Request-Mode ! $main .= " $editors ! //]]>\n</script> ! "; ! } else { // FCK-Main in Normal-Mode ! $main .= " window.onload = function initEditor() { // create the editor(s) for the related textbox(es) $editors ! return false; ! } ! //]]>\n</script> ! "; ! } } return $main; } --- 171,198 ---- // HtmlArea-Main for all Modes ! $main = $scriptHeader. ! " _editor_lang = \"".$lang."\"; _editor_url = \"http://".PHPWS_SOURCE_HTTP."mod/xwysiwyg/_htmlarea/\"; ! $scriptFooter <!-- load the main HTMLArea files --> <script type=\"text/javascript\" src=\"http://".PHPWS_SOURCE_HTTP."mod/xwysiwyg/_htmlarea/htmlarea.js\"></script> ! $scriptHeader".$loadplugs; } else if($settings['editor']=="fck") { // FCK-Main for all Modes ! $main = " <!-- load the main FCKeditor files --> <script type=\"text/javascript\" src=\"http://".PHPWS_SOURCE_HTTP."mod/xwysiwyg/_fck/fckeditor.js\"></script> ! $scriptHeader".$loadplugs; ! } ! if($settings['request_mode']) { // Request-Mode ! $main .= " $editors\n$scriptFooter"; ! } else { // Normal-Mode ! $main .= " window.onload = function initEditor() { // create the editor(s) for the related textbox(es) $editors ! return false; \n }\n$scriptFooter"; } + return $main; } *************** *** 279,283 **** $main = PHPWS_xwysiwyg::makeMain($settings,$editors,$loadplugs,$lang); } ! $main = "//]]>\n</script>".$main."<script type=\"text/javascript\">\n//<![CDATA["; //ugly hack to work with $GLOBALS['core']->js_func[] return $main; } --- 215,219 ---- $main = PHPWS_xwysiwyg::makeMain($settings,$editors,$loadplugs,$lang); } ! $main = "//]]> </script>\n".$main."<script type=\"text/javascript\"> //<![CDATA["; //ugly hack to work with $GLOBALS['core']->js_func[] return $main; } |