• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List

E:/E/GEAMP/www/openbiz/openbiz/bin/easy/element/CKEditor.php

00001 <?PHP
00017 include_once("InputElement.php");
00018 
00027 class CKEditor extends InputElement
00028 {
00029        public $m_Config;
00030        public $m_Mode;
00037     protected function readMetaData(&$xmlArr)
00038     {
00039         parent::readMetaData($xmlArr);
00040         $this->m_Mode = isset($xmlArr["ATTRIBUTES"]["MODE"]) ? $xmlArr["ATTRIBUTES"]["MODE"] : null;
00041         $this->m_Config = isset($xmlArr["ATTRIBUTES"]["CONFIG"]) ? $xmlArr["ATTRIBUTES"]["CONFIG"] : null;
00042     }
00043 
00049     public function render()
00050     {
00051         BizSystem::clientProxy()->includeCKEditorScripts();
00052 
00053         $elementName = $this->m_Name;
00054 
00055         $value = $this->getValue();
00056         $value = htmlentities($value, ENT_QUOTES, "UTF-8");
00057         $style = $this->getStyle();
00058         $width = $this->m_Width ? $this->m_Width : 600;
00059         $height = $this->m_Height ? $this->m_Height : 300;
00060         //$func = "onclick=\"editRichText('$elementName', $width, $height);\"";
00061         if(!strlen($value)>0) // fix suggested by smarques
00062             $value="&nbsp;";
00063 
00064         $type = strtolower($this->m_Mode);
00065         $fileBrowserPage = APP_URL."/bin/filebrowser/browser.html";
00066 
00067         $languageCode = I18n::getCurrentLangCode();
00068         $languageCode = str_replace("_","-",$languageCode);
00069         $config = $this->m_Config;        
00070         $sHTML .= "<textarea id=\"$elementName\" name=\"$elementName\" >$value</textarea>\n";
00071         $sHTML .= "<script type=\"text/javascript\">\n";
00072         if($config){
00073               //remove the last commas
00074               $config=trim($config);
00075               if(substr($config,strlen($config)-1,1)==','){
00076                      $config = substr($config,strlen($config)-1);
00077               }
00078               $sHTML .= "Openbiz.CKEditor.init('$elementName',{'type':'$type','filebrowserBrowseUrl':'$fileBrowserPage','language':'$languageCode','height':'$height','width':'$width',$config});\n";
00079         }else{
00080               $sHTML .= "Openbiz.CKEditor.init('$elementName',{'type':'$type','filebrowserBrowseUrl':'$fileBrowserPage','language':'$languageCode','height':'$height','width':'$width'});\n";
00081         }
00082         $sHTML .= "</script>\n";
00083         
00084         return $sHTML;
00085     }
00086 
00087 }
00088 
00089 ?>

Generated on Thu Apr 19 2012 17:09:13 for openbiz by  doxygen 1.7.2