Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: FCKeditor strange issue  (Read 1228 times)

3Pinter

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 61
    • Fromthemill.nl
FCKeditor strange issue
« on: February 21, 2007, 07:53:12 pm »

Hi,

Well, really I don't have a clue. You might, and that's what I'm hoping for!

FCKeditor installed and got it working, using a previously posted 'tutorial / mod' by a fellow user.

I noticed however that FCKeditor isn't started when trying to create a new article.
Editting a new article goes fine, it starts FCK. Creating a new one gives a bug:

Code: [Select]
FIREBUG INFO:
oFCKeditor undefined
So please guys/girls have a look at my code at get it back into the game!

Code: [Select]
... //STARTING THE COPY FROM HERE!!!! TO GIVE YOU THE POSITIONING IN SNEWS.PHP

// dependancy limiter
function dependancy() {
var category = document.forms['post']['define_category'];
var page = document.getElementById("def_page");
if (category.options[category.selectedIndex].value == "-1") { page.style.display = 'inline'; }
else { page.style.display = 'none'; }
}
//]]>

function jseditor() {
?>
 
   

}
Finally  the function:
Code: [Select]
function form_articles($contents) {
if (isset($_GET['id']) && is_numeric($_GET['id']) && !is_null($_GET['id'])) {
$id = $_GET['id'];
$query = mysql_query("SELECT * FROM ".db('prefix')."articles WHERE id='$id'");
$r = mysql_fetch_array($query);
$article_category = $r['category'];
$edit_option = substr($r['position'], 0, 1);
$edit_page = substr($r['position'], 2);
switch ($edit_option) {
case 1: $frm_fieldset = l('edit').' '.l('article'); $frm_position1 = 'selected="selected"'; break;
case 2: $frm_fieldset = l('edit').' '.l('extra_contents'); $frm_position2 = 'selected="selected"'; break;
case 3: $frm_fieldset = l('edit').' '.l('page'); $frm_position3 = 'selected="selected"'; break;
}
$frm_action = db('website').'index.php?action=process&task=admin_article&id='.$id;
$frm_title = $_SESSION['temp']['title'] ? $_SESSION['temp']['title'] : $r['title'];
$frm_sef_title = $_SESSION['temp']['seftitle'] ? cleanSEF($_SESSION['temp']['seftitle']) : $r['seftitle'];
$frm_text = str_replace('&', '&', $_SESSION['temp']['text'] ? $_SESSION['temp']['text'] : $r['text']);
$frm_meta_desc = $_SESSION['temp']['description_meta'] ? cleanSEF($_SESSION['temp']['description_meta']) : $r['description_meta'];
$frm_meta_key = $_SESSION['temp']['keywords_meta'] ? cleanSEF($_SESSION['temp']['keywords_meta']) : $r['keywords_meta'];
$frm_display_title = $r['displaytitle'] == 'YES' ? 'ok' : '';
$frm_display_info = $r['displayinfo'] == 'YES' ? 'ok' : '';
$frm_publish = $r['published'] == 1 ? 'ok' : '';
$frm_commentable = ($r['commentable'] == 'YES' || $r['commentable'] == 'FREEZ') ? 'ok' : '';
$frm_task = 'edit_article';
$frm_submit = l('edit');
} else {
switch ($contents) {
case 'article_new': $frm_fieldset = l('article_new'); $pos = 1; $frm_position1 = 'selected="selected"'; break;
case 'extra_new': $frm_fieldset = l('extra_new'); $pos = 2; $frm_position2 = 'selected="selected"'; break;
case 'page_new': $frm_fieldset = l('page_new'); $pos = 3; $frm_position3 = 'selected="selected"'; break;
}
if (empty($frm_fieldset)) { $frm_fieldset =  l('article_new'); }
$frm_action = db('website').'index.php?action=process&task=admin_article';
$frm_title = $_SESSION['temp']['title'];
$frm_sef_title = cleanSEF($_SESSION['temp']['seftitle']);
$frm_text = $_SESSION['temp']['text'];
$frm_meta_desc = cleanSEF($_SESSION['temp']['description_meta']);
$frm_meta_key = cleanSEF($_SESSION['temp']['keywords_meta']);
$frm_display_title = 'ok';
$frm_display_info = ($contents == 'extra_new') ? '' : 'ok';
$frm_publish = 'ok';
$frm_commentable = ($contents == 'extra_new' || $contents == 'page_new') ? '' : 'ok';
$frm_task = 'add_article';
$frm_submit = l('submit');
}
echo '
';
html_input('form', '', 'post', '', '', '', '', '', '', '', '', '', 'post', $frm_action, '');
html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '', $frm_fieldset);
html_input('text', 'title', 'at', $frm_title, l('title'), '', 'onchange="genSEF(this,document.forms[\'post\'].seftitle)"', 'onkeyup="genSEF(this,document.forms[\'post\'].seftitle)"', '', '', '', '', '', '', '');
if ($contents == 'extra_new' || $edit_option == 2) {
echo '
';
html_input('text', 'seftitle', 'as', $frm_sef_title, l('sef_title'), '', '', '', '', '', '', '', '', '', '');
echo '
';
} else {
html_input('text', 'seftitle', 'as', $frm_sef_title, l('sef_title'), '', '', '', '', '', '', '', '', '', '');}
jseditor();
html_input('textarea', 'text', 'txt', $frm_text, l('text'), '', '', '', '', '', '2', '100', '', '', '');
echo '

';
/*html_input('button', 'strong', '', 'B', '', 'button', 'onclick="tag(\'strong\')"', '', '', '', '', '', '', '', '');
html_input('button', 'em', '', 'I', '', 'button', 'onclick="tag(\'em\')"', '', '', '', '', '', '', '', '');
html_input('button', 'strike', '', 'Strike', '', 'button', 'onclick="tag(\'strike\')"', '', '', '', '', '', '', '', '');
html_input('button', 'p', '', 'P', '', 'button', 'onclick="tag(\'p\')"', '', '', '', '', '', '', '', '');
html_input('button', 'br', '', 'BR', '', 'button', 'onclick="tag(\'br\')"', '', '', '', '', '', '', '', '');
html_input('button', 'break', '', 'Break', '', 'button', 'onclick="tag(\'break\')"', '', '', '', '', '', '', '', '');
html_input('button', 'img', '', 'Image', '', 'button', 'onclick="tag(\'img\')"', '', '', '', '', '', '', '', '');
html_input('button', 'link', '', 'Link', '', 'button', 'onclick="tag(\'link\')"', '', '', '', '', '', '', '', '');
html_input('button', 'include', '', 'Include', '', 'button', 'onclick="tag(\'include\')"', '', '', '', '', '', '', '', '');
      if (isset($_GET["richarea"])){
        html_input('button', 'SimpleEditor', '', 'Simple Editor', '', 'button', 'onclick="document.location=document.location.href.substr(0,document.location.href.indexOf(\'&richarea=\'))"', '', '', '', '', '', '', '', '');
    }else{
        html_input('button', 'RichEditor', '', 'Rich Editor', '', 'button', 'onclick="document.location=document.location + \'&richarea=\'"', '', '', '', '', '', '', '', '');
    }*/

echo '

';
if ($contents == 'article_new' || $edit_option == 1) {
html_input('checkbox', 'publish_article', 'pu', 'YES', l('publish_article'), '', '', '', '', $frm_publish, '', '', '', '', '');
}
echo '';
html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '', ''.l('preview').'');
echo '';
html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '', ''.l('customize').'');
echo '';
if ($contents == 'article_new' || $edit_option == 1) {
html_input('fieldset', '', '', '', '', '', '', '', '', '', '', '', '', '', ''.l('publish_date').'');
echo '';
}
echo '

';
html_input('hidden', 'task', 'task', 'admin_article', '', '', '', '', '', '', '', '', '', '', '');
html_input('submit', $frm_task, $frm_task, $frm_submit, '', '', '', '', '', '', '', '', '', '', '');
if (!empty($id)) {
html_input('hidden', 'id', 'id', $id, '', '', '', '', '', '', '', '', '', '', '');
html_input('submit', 'delete_article', 'delete_article', l('delete'), '', '', 'onclick="javascript: return pop()"', '', '', '', '', '', '', '', '');
}
echo '

';
}
(Again) Please help!


3Pinter