1574 * @return string HTML and Javascript code. |
1574 * @return string HTML and Javascript code. |
1575 */ |
1575 */ |
1576 |
1576 |
1577 function tinymce_textarea($name, $content = '', $rows = 20, $cols = 60) |
1577 function tinymce_textarea($name, $content = '', $rows = 20, $cols = 60) |
1578 { |
1578 { |
|
1579 global $lang; |
1579 $randomid = md5(microtime() . mt_rand()); |
1580 $randomid = md5(microtime() . mt_rand()); |
1580 $html = ''; |
1581 $html = ''; |
1581 $html .= '<textarea name="' . $name . '" rows="'.$rows.'" cols="'.$cols.'" style="width: 100%;" id="toggleMCEroot_'.$randomid.'">' . $content . '</textarea>'; |
1582 $html .= '<textarea name="' . $name . '" rows="'.$rows.'" cols="'.$cols.'" style="width: 100%;" id="toggleMCEroot_'.$randomid.'">' . $content . '</textarea>'; |
1582 $html .= '<div style="float: right; display: table;" id="mceSwitchAgent_' . $randomid . '">text editor | <a href="#" onclick="if ( !KILL_SWITCH ) { toggleMCE_'.$randomid.'(); return false; }">graphical editor</a></div>'; |
1583 $html .= '<div style="float: right; display: table;" id="mceSwitchAgent_' . $randomid . '">' . $lang->get('etc_tinymce_btn_text') . ' | <a href="#" onclick="if ( !KILL_SWITCH ) { toggleMCE_'.$randomid.'(); return false; }">' . $lang->get('etc_tinymce_btn_graphical') . '</a></div>'; |
1583 $html .= '<script type="text/javascript"> |
1584 $html .= '<script type="text/javascript"> |
1584 // <![CDATA[ |
1585 // <![CDATA[ |
1585 function toggleMCE_'.$randomid.'() |
1586 function toggleMCE_'.$randomid.'() |
1586 { |
1587 { |
1587 var the_obj = document.getElementById(\'toggleMCEroot_' . $randomid . '\'); |
1588 var the_obj = document.getElementById(\'toggleMCEroot_' . $randomid . '\'); |
1588 var panel = document.getElementById(\'mceSwitchAgent_' . $randomid . '\'); |
1589 var panel = document.getElementById(\'mceSwitchAgent_' . $randomid . '\'); |
|
1590 var text_editor = $lang.get("etc_tinymce_btn_text"); |
|
1591 var graphical_editor = $lang.get("etc_tinymce_btn_graphical"); |
1589 if ( the_obj.dnIsMCE == "yes" ) |
1592 if ( the_obj.dnIsMCE == "yes" ) |
1590 { |
1593 { |
1591 $dynano(the_obj).destroyMCE(); |
1594 $dynano(the_obj).destroyMCE(); |
1592 panel.innerHTML = \'text editor | <a href="#" onclick="if ( !KILL_SWITCH ) { toggleMCE_'.$randomid.'(); return false; }">graphical editor</a>\'; |
1595 panel.innerHTML = text_editor + \' | <a href="#" onclick="if ( !KILL_SWITCH ) { toggleMCE_'.$randomid.'(); return false; }">\' + graphical_editor + \'</a>\'; |
1593 } |
1596 } |
1594 else |
1597 else |
1595 { |
1598 { |
1596 $dynano(the_obj).switchToMCE(); |
1599 $dynano(the_obj).switchToMCE(); |
1597 panel.innerHTML = \'<a href="#" onclick="if ( !KILL_SWITCH ) { toggleMCE_'.$randomid.'(); return false; }">text editor</a> | graphical editor\'; |
1600 panel.innerHTML = \'<a href="#" onclick="if ( !KILL_SWITCH ) { toggleMCE_'.$randomid.'(); return false; }">\' + text_editor + \'</a> | \' + graphical_editor; |
1598 } |
1601 } |
1599 } |
1602 } |
1600 // ]]> |
1603 // ]]> |
1601 </script>'; |
1604 </script>'; |
1602 return $html; |
1605 return $html; |