Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

FCK WYSIWYG HTML editor


spooks

Recommended Posts

I'm now having some problems with FCKeditor and Header Tags SEO on products description page and hopefully someone can help.

 

I have this error after installing Header Tags SEO

Fatal error: Call to undefined function tep_draw_textarea_field()

 

My whole site seems to be having this error in areas that calls out this fuction but I don't need to have fckeditor on every thing such as product tags description, meta tags ... etc

 

It used to work fine on a test site but after trying this on the real site, this happen. Can someone help?

 

Thanks!

Link to comment
Share on other sites

I'm now having some problems with FCKeditor and Header Tags SEO on products description page and hopefully someone can help.

 

I have this error after installing Header Tags SEO

 

 

My whole site seems to be having this error in areas that calls out this fuction but I don't need to have fckeditor on every thing such as product tags description, meta tags ... etc

 

It used to work fine on a test site but after trying this on the real site, this happen. Can someone help?

 

Thanks!

 

Sure you not deletet or replaced this function in html_output.php when installing FCK. You should have one for textarea and one for fckeditor.

Link to comment
Share on other sites

Not sure where this should be posted. It seems to be a missmatch in the way thoose 2 functions work. I dont want to install a second editor. Is there anyone that have fck working with Header Tags SEO

 

I have latest fckeditor installed and working.

I have latest HTC installed and working.

 

But when i try to change the HTC to use fckeditor on categories description i am stuck in how to merge the 2 different statments.

I get FCK editor to show in HTC bit missplaced.

It load values from DB at the first time, but owerwrite with empty if i save. When reloading again it is empty.

 

 

	case 'edit_category':
xxxx
xxxx
xxxx
$category_htc_description_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_textarea_field('categories_htc_description[' . $languages[$i]['id'] . ']', 'hard', 30, 5, tep_get_category_htc_description($cInfo->categories_id, $languages[$i]['id']));		 /*** End Header Tags SEO ***/

 

 

 

	 case 'edit_category':
xxxx
xxxx
xxxx
$category_htc_description_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_fckeditor('categories_htc_description[' . $languages[$i]['id'] . ']','600','300',(isset($categories_htc_description[$languages[$i]['id']]) ? stripslashes($categories_htc_description[$languages[$i]['id']]) : tep_get_category_htc_description($cInfo->categories_id, $languages[$i]['id']));		 /*** End Header Tags SEO ***/

 

 

Both functions are in HTML_output and both are set to return the same variable.

 

Is there any who have FCK working with HTC who can share a solution to this. Both for the coding part and the messed up placement of the input boxes.

Link to comment
Share on other sites

Not sure where this should be posted. It seems to be a missmatch in the way thoose 2 functions work. I dont want to install a second editor. Is there anyone that have fck working with Header Tags SEO

 

I have latest fckeditor installed and working.

I have latest HTC installed and working.

 

But when i try to change the HTC to use fckeditor on categories description i am stuck in how to merge the 2 different statments.

I get FCK editor to show in HTC bit missplaced.

It load values from DB at the first time, but owerwrite with empty if i save. When reloading again it is empty.

 

 

	case 'edit_category':
xxxx
xxxx
xxxx
$category_htc_description_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_textarea_field('categories_htc_description[' . $languages[$i]['id'] . ']', 'hard', 30, 5, tep_get_category_htc_description($cInfo->categories_id, $languages[$i]['id']));		 /*** End Header Tags SEO ***/

 

 

 

	 case 'edit_category':
xxxx
xxxx
xxxx
$category_htc_description_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_fckeditor('categories_htc_description[' . $languages[$i]['id'] . ']','600','300',(isset($categories_htc_description[$languages[$i]['id']]) ? stripslashes($categories_htc_description[$languages[$i]['id']]) : tep_get_category_htc_description($cInfo->categories_id, $languages[$i]['id']));		 /*** End Header Tags SEO ***/

 

 

Both functions are in HTML_output and both are set to return the same variable.

 

Is there any who have FCK working with HTC who can share a solution to this. Both for the coding part and the messed up placement of the input boxes.

 

You have two variations in the function, perhaps the error is elsewhere in your code, have you tried using

 

	 case 'edit_category':
xxxx
xxxx
xxxx
$category_htc_description_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_fckeditor('categories_htc_description[' . $languages[$i]['id'] . ']','600','300', tep_get_category_htc_description($cInfo->categories_id, $languages[$i]['id']));		 /*** End Header Tags SEO ***/

 

Its not surprising there are layout problems, FCK needs a larger window, you`ve set 600px wide, the original text function is only 30 chars wide.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

You have two variations in the function, perhaps the error is elsewhere in your code, have you tried using

 

	 case 'edit_category':
xxxx
xxxx
xxxx
$category_htc_description_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_fckeditor('categories_htc_description[' . $languages[$i]['id'] . ']','600','300', tep_get_category_htc_description($cInfo->categories_id, $languages[$i]['id']));		 /*** End Header Tags SEO ***/

 

Its not surprising there are layout problems, FCK needs a larger window, you`ve set 600px wide, the original text function is only 30 chars wide.

 

I tryed your excample and with no luck. Still same problem. FCK editor is showing OK, it's read content from DB, but when saving all is lost.

I have tryed many variant of the code but with no luck.

 

The width problem dont wory me to mutch now as FCK window shows at full with at top. That problem i can look into after.

 

The main ting now is to solve the coding part to get the function to work.

Link to comment
Share on other sites

I tryed on a smaller function with less code and with same problem. It seems as the text you write into fckeditor is not saved to the return variable. so when you use the save function in HTC it is empty.

Link to comment
Share on other sites

What are you clicking to save? if you use the save within the edit window it may not work, fix is on the fck site.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

I've installed the Information Pages Unlimited contribution and with it, the most current version of the FCKeditor. I've gone through and checked and rechecked that I've installed each step correctly.

 

When I try to access the following pages, I get the following errors:

 

new product

Fatal error: Call to undefined function: tep_draw_fckeditor() in /home/hgdadmin/public_html/catalog/admin/categories.php on line 541

 

add information page

Fatal error: Call to undefined function: tep_draw_fckeditor() in /home/hgdadmin/public_html/catalog/admin/information_form.php on line 96

So, after looking through these boards, I can see that my problem is that these pages cannot find my function. And, I believe that the problem is in my catalog/admin/fckeditor/editor/filemanager/connectors/php/config.php file. Now.... I've gone and tried every way that I can think of to update my config.php file and just cannot seem to get it.

 

After bouncing around the boards, I've set my latest path listed in the config.php file as:

$Config['UserFilesPath'] = '/userfiles/';

$Config['UserFilesAbsolutePath'] =  '/home/xxxx/public_html/catalog/userfiles/';

 

I've also tried about 100 different varieties of /catalog, etc.... For what it's worth, my actual path to the FCKeditor file is: /home/xxxx/public_html/catalog/admin/fckeditor/fckeditor.php

 

After more looking around, I've seen some posts alluding to the problem being in the html_output.php file. I currently have:

 

// Output a form textarea field w/ fckeditor

function tep_draw_fckeditor($name, $width, $height, $text='') {

 

$oFCKeditor = new FCKeditor($name);

$oFCKeditor -> Width = $width;

$oFCKeditor -> Height = $height;

$oFCKeditor -> BasePath = 'fckeditor/';

$oFCKeditor -> Value = $text;

$field = $oFCKeditor->Create($name);

}

return $field;

}

 

 

I tried to change the Basepath to everything from '/home/xxxx/public_html/catalog/admin/fckeditor/' and everything in between.

 

I'm guessing that there has GOT to be some place where I don't have the path defined correctly. If someone could just point me to that place - I would really appreciate it!

 

Thanks,

Moez

Link to comment
Share on other sites

check aplication_top has require(DIR_WS_FUNCTIONS . 'html_output.php');

check you added the function to /admin/includes/functions/html_output.php

and not /includes/functions/html_output.php

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

check aplication_top has require(DIR_WS_FUNCTIONS . 'html_output.php');

check you added the function to /admin/includes/functions/html_output.php

and not /includes/functions/html_output.php

 

Thanks, Spooks. Yep, I verified both. Just to let you know where I'm at - I basically have a brand new install and was just laying this contribution in on top. I've gone through line by line and verified the changes in the documentation (3 times as a matter of fact...).

 

So, is the path that is defined in html_output the one that is probably the culprit? Or, is there some other file that has a path defined in it that is getting me?

Link to comment
Share on other sites

What are you clicking to save? if you use the save within the edit window it may not work, fix is on the fck site.

 

I tryed saving both in the edit window and the save function on the page. Neighter saves any data to DB.

 

I looked at FCK site but dident find any fix. I use v. 2.6.3 download 2 days ago. Is the fix still needed. If you have a link i would be greatful :-)

Link to comment
Share on other sites

if your error is 'Call to undefined function: tep_draw_fckeditor() '

then you have not defined it, so either you did not mod /admin/includes/functions/html_output.php or

 

you made errors when editing /admin/includes/functions/html_output.php to disable the added function or

you have not uploaded your modded /admin/includes/functions/html_output.php or

you have altered /admin/includes/application_top.php to remove require(DIR_WS_FUNCTIONS . 'html_output.php');

 

 

thats it, no other possibilities.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

I've considered this further, I think its likely that that the problem is fck is appearing outside the form on the browser page, causing your issue, you'll need to rewrite that part of categories to fix the layout issue.

 

The categories edits are done within a infobox, products are not, so make your category edits like the product edit page.

 

fck is designed to replace a text area field, you are trying to use it to replace a input field, this may be creating part of the problem.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

I've considered this further, I think its likely that that the problem is fck is appearing outside the form on the browser page, causing your issue, you'll need to rewrite that part of categories to fix the layout issue.

 

The categories edits are done within a infobox, products are not, so make your category edits like the product edit page.

 

fck is designed to replace a text area field, you are trying to use it to replace a input field, this may be creating part of the problem.

 

Thanks, but fck is replacing a textare field

 

$category_htc_description_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_textarea_field('categories_htc_description[' . $languages[$i]['id'] . ']', 'hard', 30, 5, tep_get_category_htc_description($cInfo->categories_id, $languages[$i]['id']));

 

And it is placed at the same place in the code, the reformating is due to the different in width. Should this breakr the form?

 

I will have å look into the formatting to get it all in the same way as products.

 

If you should come up with any more suggestions i will be gratefull, and thank you again for helping out...

Link to comment
Share on other sites

Hey to all,

 

and first thanks for that support and these quick replies.

Now to my problem.

I`ve installed the latest FCK 2.6.3 in oscommerce (prod.description , cat.description). First everything seems to work fine.

But when I do an update in the category description, the text ist gone. Not so in Product Description.

And the best ist ... when i see the Form-Field without FCK, the code ist there. Best ... see picture below.

Anyone an idea about the reason?

Thanks for your attention!

 

Mitch

FCK.gif

Link to comment
Share on other sites

A possibility I detailed was a conflict with the infobox, I can see you've modified the layout, but are you still using the infobox, or have you modified further.

 

NB Postig your current code may help resolve this.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Please forget my last post (empty) ... don`t know, what went wrong!

 

Hey Spooks,

 

thanks for your urgend reply. This is too much code for here ... so I link to a pdf with the "categories.php"code.

BTW I´ve modified several oscommerce sites to normal CMS (without shop ... f.e. www.dr.holl.de, www.saegewerk-wich.de etc.) My site www.wieden.com is also modified, but this is not the site I`m talking about.

If you want, you can take a look at

 

www.gstgmbh.de/sicherheit/index.php

 

This is the site, I currently mean.

 

Here are the two snippets I mean:

 

Products Description - Works

 <tr>
			<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>
		  <td class="main"><?php //echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']','600','500',(isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id'])));
		  echo tep_draw_fckeditor('products_description[' . $languages[$i]['id'] . ']','600','500',(isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>
		  </tr>

 

Categories Description - Destroys updates (The manual inputs sent to database are perfect, but when I try to update, everything is gone)

 

<tr>
			<td class="main"><?php echo tep_draw_textarea_field('categories_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (($categories_description[$languages[$i]['id']]) ? stripslashes($categories_description[$languages[$i]['id']]) : tep_get_category_description($cInfo->categories_id, $languages[$i]['id']))); ?>
							  <?php // echo tep_draw_fckeditor('categories_description[' . $languages[$i]['id'] . ']','600','300',(isset($categories_description[$languages[$i]['id']]) ? stripslashes($categories_description[$languages[$i]['id']]) : tep_get_category_description($pInfo->categories_id, $languages[$i]['id']))); ?></td>
		  </tr>

 

Here the link to the pdf

 

Thanks again

Mitch

Edited by e-peoples
Link to comment
Share on other sites

Please forget my last post (empty) ... don`t know, what went wrong!

 

....

 

Hi, i have the same problem with FCK and the HTC 3.0.9 categori description. I have tryed many different variant of the code but no luck get it working.

 

I found out hov to modyfi the design so that all input field use whole width under the categori list.

Se this post for the solution to that.

 

FCK willl show the description if there is already in DB, but when save it become empty. I am not sure it is the FCK code that are wrong, maybe it is the save function that can not handel the input from FCK. But i am not that mutch of a php coder to fully understand everything.

 

Hopefully we can get this to work..:-)

Link to comment
Share on other sites

Hey,

 

there`s another problem, i can`t fix. I use the contrib "Extra Pages", an integrated FCK too in admin. When I save the text, FCK adds a further "</br> to every existing "<br>. So now the text is double-lined instead of single lined. I checked admin in several Browsers (Safari, Firefox, I.E.6) ...same result.

 

I cann`t get an idea, why FCK acts different in different places within one site! The Products Description in the same site runs well! I checked several Forums in the web, and realised, that there are some people with the same problem ... but no solution until now.

 

Thanks again!

Best from bavaria

Mitch

 

Here`s the code

 

<?php
 require('includes/application_top.php');

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 if (tep_not_null($action)) {
switch($action){
  case 'setflag':
	if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {
	  if (isset($HTTP_GET_VARS['pID'])) {
		tep_db_query("update pages set pages_status='".$HTTP_GET_VARS['flag']."' where pages_id='".$HTTP_GET_VARS['pID']."'");
	  }
	  if (USE_CACHE == 'true') {
		tep_reset_cache_block('pages');
	  }
	}

	tep_redirect(tep_href_link(FILENAME_PAGES, 'pID=' . $HTTP_GET_VARS['pID']));
	break;
  case 'insert_page':
  case 'update_page':
	if (isset($HTTP_POST_VARS['edit_x']) || isset($HTTP_POST_VARS['edit_y'])) {
	  $action = 'new_page';
	} else {
	  if (isset($HTTP_GET_VARS['pID'])) $pages_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);

	  $sql_data_array = array('pages_name' => tep_db_prepare_input($HTTP_POST_VARS['pages_name']),
							  'pages_image' => tep_db_prepare_input($HTTP_POST_VARS['pages_image']),
							  'pages_status' => tep_db_prepare_input($HTTP_POST_VARS['pages_status']),
							  'sort_order' => tep_db_prepare_input($HTTP_POST_VARS['sort_order']));

	  if ($action == 'insert_page') {
		tep_db_perform(TABLE_PAGES, $sql_data_array);
		$pages_id = tep_db_insert_id();
	  }
	  elseif ($action == 'update_page') {
		tep_db_perform(TABLE_PAGES, $sql_data_array, 'update', "pages_id = '" . (int)$pages_id . "'");
	  }

	  $languages = tep_get_languages();
	  for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
		$pages_title_array = $HTTP_POST_VARS['pages_title'];
		$pages_body_array = $HTTP_POST_VARS['pages_body'];
		$language_id = $languages[$i]['id'];

		$sql_data_array = array('pages_title' => tep_db_prepare_input($pages_title_array[$language_id]),
								'pages_body' => tep_db_prepare_input($pages_body_array[$language_id]));

		if ($action == 'insert_page') {
		  $insert_sql_data = array('pages_id' => $pages_id,
								   'language_id' => $languages[$i]['id']);

		  $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

		  tep_db_perform(TABLE_PAGES_DESCRIPTION, $sql_data_array);
		}
		elseif ($action == 'update_page') {
		  tep_db_perform(TABLE_PAGES_DESCRIPTION, $sql_data_array, 'update', "pages_id = '" . (int)$pages_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
		}
	  }

	  if ($pages_image = new upload('pages_image', DIR_FS_CATALOG_IMAGES)) {
		tep_db_query("update " . TABLE_PAGES . " set pages_image = '" . tep_db_prepare_input($HTTP_POST_VARS['pages_image']) . "' where pages_id = '" . (int)$pages_id . "'"); }

	  if (USE_CACHE == 'true') {
		tep_reset_cache_block('pages');
	  }

	  tep_redirect(tep_href_link(FILENAME_PAGES, 'pID=' . $pages_id));
	}
	break;

  case 'delete_page_confirm':
	if (isset($HTTP_POST_VARS['pages_id'])) {
	  $pages_id = tep_db_prepare_input($HTTP_POST_VARS['pages_id']);
	  if($pages_id!=1 && $pages_id!=2){
		tep_db_query("delete from " . TABLE_PAGES . " where pages_id = '" . (int)$pages_id . "'");
		tep_db_query("delete from " . TABLE_PAGES_DESCRIPTION . " where pages_id = '" . (int)$pages_id . "'");
	  }
	}

	if (USE_CACHE == 'true') {
	  tep_reset_cache_block('pages');
	}

	tep_redirect(tep_href_link(FILENAME_PAGES));
	break;
  case 'new_page_preview':
	$pages_image = new upload('pages_image');
	$pages_image->set_destination(DIR_FS_CATALOG_IMAGES);
	if ($pages_image->parse() && $pages_image->save()) {
	  $pages_image_name = $pages_image->filename;
	} else {
	  $pages_image_name = (isset($HTTP_POST_VARS['pages_previous_image']) ? $HTTP_POST_VARS['pages_previous_image'] : '');
	}
	break;

}
 }

// check if the catalog image directory exists
 if (is_dir(DIR_FS_CATALOG_IMAGES)) {
if (!is_writeable(DIR_FS_CATALOG_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');
 } else {
$messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');
 }

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();" >
<div id="spiffycalendar" class="text"></div>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top">

<?php
 if ($action == 'new_page') {
$parameters = array('pages_name' => '',
					'pages_title' => '',
					'pages_body' => '',
					'pages_id' => '',
					'pages_image' => '',
					'pages_status' => '',
					'sort_order' => '');

$pInfo = new objectInfo($parameters);

if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {
  $page_query = tep_db_query("select pd.pages_title, pd.pages_body, p.pages_id, p.pages_name, p.pages_image, p.pages_status, p.sort_order from " . TABLE_PAGES . " p, " . TABLE_PAGES_DESCRIPTION . " pd where p.pages_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.pages_id = pd.pages_id and pd.language_id = '" . (int)$languages_id . "'");
  $page = tep_db_fetch_array($page_query);
  $pInfo->objectInfo($page);
} elseif (tep_not_null($HTTP_POST_VARS)) {
  $pInfo->objectInfo($HTTP_POST_VARS);
  $pages_name = $HTTP_POST_VARS['pages_name'];
  $pages_title = $HTTP_POST_VARS['pages_title'];
  $pages_body = $HTTP_POST_VARS['pages_body'];
}

$languages = tep_get_languages();

if (!isset($pInfo->pages_status)) $pInfo->pages_status = '1';
switch ($pInfo->pages_status) {
  case '0': $in_status = false; $out_status = true; break;
  case '1':
  default: $in_status = true; $out_status = false;
}
?>
<?php echo tep_draw_form('new_page', FILENAME_PAGES, 'action=new_page_preview' . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : ''), 'post', 'enctype="multipart/form-data"'); ?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo sprintf(TEXT_NEW_PAGE) ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><?php echo TEXT_PAGES_STATUS; ?></td>
		<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('pages_status', '1', $in_status) . ' ' . TEXT_PAGE_ACTIVE . ' ' . tep_draw_radio_field('products_status', '0', $out_status) . ' ' . TEXT_PAGE_NOT_ACTIVE; ?></td>
	  </tr>
	  <tr>
		<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo TEXT_PAGES_NAME; ?></td>
		<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('pages_name', (isset($pages_name) ? $pages_name : tep_get_pages_name($pInfo->pages_id))); ?></td>
	  </tr>
	  <tr>
		<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo TEXT_PAGES_IMAGE; ?></td>
		<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_file_field('pages_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $pInfo->pages_image . tep_draw_hidden_field('pages_previous_image', $pInfo->pages_image); ?></td>
	  </tr>
	  <tr>
		<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
	  </tr>
<?php
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
	  <tr>
		<td class="main"><?php if ($i == 0) echo TEXT_PAGES_TITLE; ?></td>
		<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('pages_title[' . $languages[$i]['id'] . ']', (isset($pages_title[$languages[$i]['id']]) ? $pages_title[$languages[$i]['id']] : tep_get_pages_title($pInfo->pages_id, $languages[$i]['id']))); ?></td>
	  </tr>
<?php
}
?>
	  <tr>
		<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
	  </tr>
<?php
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
	  <tr>
		<td class="main" valign="top"><?php if ($i == 0) echo TEXT_PAGES_BODY; ?></td>
		<td><table border="0" cellspacing="0" cellpadding="0">
		  <tr>
			<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>
			<td class="main">
			<?php echo tep_draw_fckeditor('pages_body[' . $languages[$i]['id'] . ']','600','600',(isset($products_description[$languages[$i]['id']]) ? stripslashes($pages_body[$languages[$i]['id']]) : tep_get_pages_body($pInfo->pages_id, $languages[$i]['id']))); ?>
			<?php // echo tep_draw_textarea_field('pages_body[' . $languages[$i]['id'] . ']', 'soft', '60', '15', (isset($pages_body[$languages[$i]['id']]) ? $pages_body[$languages[$i]['id']] : tep_get_pages_body($pInfo->pages_id, $languages[$i]['id']))); ?></td>
		  </tr>
		</table></td>
	  </tr>
<?php
}
?>
	  <tr>
		<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo TEXT_SORT_ORDER; ?></td>
		<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sort_order', $pInfo->sort_order); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr>
	<td class="main" align="right"><?php echo tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . '  <a href="' . tep_href_link(FILENAME_PAGES, (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
  </tr>
</table></form>
<?php
 } elseif ($action == 'new_page_preview') {
if (tep_not_null($HTTP_POST_VARS)) {
  $pInfo = new objectInfo($HTTP_POST_VARS);
  $pages_name = $HTTP_POST_VARS['pages_name'];
  $pages_title = $HTTP_POST_VARS['pages_title'];
  $pages_body = $HTTP_POST_VARS['pages_body'];
} else {
  $page_query = tep_db_query("select p.pages_id, p.pages_name, p.pages_status, p.pages_image, p.sort_order, pd.language_id, pd.pages_title, pd.pages_body from " . TABLE_PAGES . " p, " . TABLE_PAGES_DESCRIPTION . " pd where p.pages_id = pd.pages_id and p.pages_id = '" . (int)$HTTP_GET_VARS['pID'] . "'");
  $page = tep_db_fetch_array($page_query);

  $pInfo = new objectInfo($page);
  $pages_image_name = $pInfo->pages_image;
}

$form_action = (isset($HTTP_GET_VARS['pID'])) ? 'update_page' : 'insert_page';

echo tep_draw_form($form_action, FILENAME_PAGES, 'action=' . $form_action . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : ''), 'post', 'enctype="multipart/form-data"');

$languages = tep_get_languages();
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
  if (isset($HTTP_GET_VARS['read']) && ($HTTP_GET_VARS['read'] == 'only')) {
	$pInfo->pages_title = tep_get_pages_title($pInfo->pages_id, $languages[$i]['id']);
	$pInfo->pages_body = tep_get_pages_body($pInfo->pages_id, $languages[$i]['id']);
  } else {
	$pInfo->pages_title = tep_db_prepare_input($pages_title[$languages[$i]['id']]);
	$pInfo->pages_body = tep_db_prepare_input($pages_body[$languages[$i]['id']]);
  }
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . $pInfo->pages_title; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  </tr>
  <tr>
	<td class="main"><?php echo tep_image(DIR_WS_CATALOG_IMAGES . $pages_image_name, $pInfo->pages_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"') . nl2br($pInfo->pages_body); ?></td>
  </tr>
<?php
}
if (isset($HTTP_GET_VARS['read']) && ($HTTP_GET_VARS['read'] == 'only')) {
  if (isset($HTTP_GET_VARS['origin'])) {
	$pos_params = strpos($HTTP_GET_VARS['origin'], '?', 0);
	if ($pos_params != false) {
	  $back_url = substr($HTTP_GET_VARS['origin'], 0, $pos_params);
	  $back_url_params = substr($HTTP_GET_VARS['origin'], $pos_params + 1);
	} else {
	  $back_url = $HTTP_GET_VARS['origin'];
	  $back_url_params = '';
	}
  } else {
	$back_url = FILENAME_PAGES;
	$back_url_params = 'pID=' . $pInfo->pages_id;
  }
?>
  <tr>
	<td align="right"><?php echo '<a href="' . tep_href_link($back_url, $back_url_params, 'NONSSL') . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
  </tr>
<?php
} else {
?>
  <tr>
	<td align="right" class="smallText">
<?php
/* Re-Post all POST'ed variables */
  reset($HTTP_POST_VARS);
  while (list($key, $value) = each($HTTP_POST_VARS)) {
	if (!is_array($HTTP_POST_VARS[$key])) {
	  echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
	}
  }
  $languages = tep_get_languages();
  for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
	echo tep_draw_hidden_field('pages_title[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($pages_title[$languages[$i]['id']])));
	echo tep_draw_hidden_field('pages_body[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($pages_body[$languages[$i]['id']])));
  }
  echo tep_draw_hidden_field('pages_image', stripslashes($pages_image_name));

  echo tep_image_submit('button_back.gif', IMAGE_BACK, 'name="edit"') . '  ';

  if (isset($HTTP_GET_VARS['pID'])) {
	echo tep_image_submit('button_update.gif', IMAGE_UPDATE);
  } else {
	echo tep_image_submit('button_insert.gif', IMAGE_INSERT);
  }
  echo '  <a href="' . tep_href_link(FILENAME_PAGES, (isset($HTTP_GET_VARS['pID']) ? 'pID=' . $HTTP_GET_VARS['pID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';
?>
	</td>
  </tr>
</table></form>
<?php
}
 } else {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr class="dataTableHeadingRow">
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PAGE_NAME; ?></td>
			<td class="dataTableHeadingContent" align="left"><?php echo TABLE_HEADING_PAGE_TITLE; ?></td>
			<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_PAGE_STATUS; ?></td>
			<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
		  </tr>
<?php
$pages_count = 0;
$pages_query = tep_db_query("select p.pages_id, p.pages_name, p.pages_image, p.pages_status, p.sort_order, pd.pages_title  from " . TABLE_PAGES . " p, " . TABLE_PAGES_DESCRIPTION . " pd where p.pages_id = pd.pages_id and pd.language_id = '" . (int)$languages_id . "' order by p.sort_order");
while ($pages = tep_db_fetch_array($pages_query)) {
  $pages_count++;
  $rows++;

  if ( (!isset($HTTP_GET_VARS['pID']) || (isset($HTTP_GET_VARS['pID']) && ($HTTP_GET_VARS['pID'] == $pages['pages_id']))) && !isset($pInfo) && (substr($action, 0, 3) != 'new')) {
	$pInfo = new objectInfo($pages);
  }

  if (isset($pInfo) && is_object($pInfo) && ($pages['pages_id'] == $pInfo->pages_id) ) {
	echo '			  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_PAGES, 'pID=' . $pages['pages_id'] . '&action=new_page_preview&read=only') . '\'">' . "\n";
  } else {
	echo '			  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_PAGES, 'pID=' . $pages['pages_id']) . '\'">' . "\n";
  }
?>
			<td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_PAGES, 'pID=' . $pages['pages_id'] . '&action=new_page_preview&read=only') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a> ' . $pages['pages_name']; ?></td>
			<td class="dataTableContent"><?php echo $pages['pages_title']; ?></td>
			<td class="dataTableContent" align="center">
<?php
  if ($pages['pages_status'] == '1') {
	echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '  <a href="' . tep_href_link(FILENAME_PAGES, 'action=setflag&flag=0&pID=' . $pages['pages_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';
  } else {
	echo '<a href="' . tep_href_link(FILENAME_PAGES, 'action=setflag&flag=1&pID=' . $pages['pages_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>  ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
  }
?>
			</td>
			<td class="dataTableContent" align="right"><?php if (isset($pInfo) && is_object($pInfo) && ($pages['pages_id'] == $pInfo->pages_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_PAGES, 'pID=' . $pages['pages_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
		  </tr>
<?php
}
?>
		  <tr>
			<td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td class="smallText"><?php echo TEXT_PAGES . ' ' . $pages_count; ?></td>
				<td align="right" class="smallText"><?php echo '<a href="' . tep_href_link(FILENAME_PAGES, 'action=new_page') . '">' . tep_image_button('button_new_page.gif', IMAGE_NEW_PAGE) . '</a>'; ?> </td>
			  </tr>
			</table></td>
		  </tr>
		</table></td>
<?php
$heading = array();
$contents = array();
switch ($action) {
  case 'delete_page':
	$heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_PAGE . '</b>');

	$contents = array('form' => tep_draw_form('pages', FILENAME_PAGES, 'action=delete_page_confirm') . tep_draw_hidden_field('pages_id', $pInfo->pages_id));
	$contents[] = array('text' => TEXT_DELETE_PAGE_INTRO);
	$contents[] = array('text' => '<br><b>' . $pInfo->pages_name . '</b>');
	$contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_PAGES, 'pID=' . $pInfo->pages_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
	break;
  default:
	if (isset($pInfo) && is_object($pInfo)) { // page info box contents
	  $heading[] = array('text' => '<b>' . tep_get_pages_title($pInfo->pages_id, $languages_id) . '</b>');

	  $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_PAGES, 'pID=' . $pInfo->pages_id . '&action=new_page') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_PAGES, 'pID=' . $pInfo->pages_id . '&action=delete_page') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
	  $contents[] = array('text' => '<br>' . TEXT_PAGES_NAME . ' ' . $pInfo->pages_name);
	  $contents[] = array('text' => '<br>' . tep_info_image($pInfo->pages_image, $pInfo->pages_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $pInfo->pages_image);
	  $contents[] = array('text' => '<br>' . TEXT_SORT_ORDER . ' ' . $pInfo->sort_order);
	}
	break;
}

if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
  echo '			<td width="25%" valign="top">' . "\n";

  $box = new box;
  echo $box->infoBox($heading, $contents);

  echo '			</td>' . "\n";
}
?>
	  </tr>
	</table></td>
  </tr>
</table>
<?php
 }
?>

</td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

In tests I've done on a quick look I found the issue is the fck field is not being added to the form, so as there is no field on the next dbase write its cleared.

 

You can check the status of the vars with this code:

 

function getDefinedVars($varList, $excludeList)
 {
  $temp1 = array_values(array_diff(array_keys($varList), $excludeList));
  $temp2 = array();
  while (list($key, $value) = each($temp1)) {
	  global $$value;
	  $temp2[$value] = $$value;
  }
  return $temp2;
 }
$excludeList = array('GLOBALS', '_FILES', '_COOKIE', 'excludeList');
//get all variables defined in current scope
 $varList = get_defined_vars();
//call the function
 print "<pre>";
 print_r(getDefinedVars($varList, $excludeList));
 print "</pre>";

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

I think this is outside the scope of this thread, you would be better addressing that to the extra pages threads.

 

Alll I can say is I have written my own code for additional pages using fck which works fine & don't have this issue, so its in that contrib somewhere.

Edited by spooks

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

First off, let me say this is a brilliant contrib and for the most part I have everything working very nicely except. Once a product has been added, images uploaded etc. If you go back and edit the text using FCK, the changes do not take effect.

 

It seems that if you don't get it right the first time you're screwed!

 

Hinky hey!

Link to comment
Share on other sites

Thats not normal, there must be an error in your install, probably language related.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Thats not normal, there must be an error in your install, probably language related.

 

Thanks for the prompt response spooks. When you say an error in the install, are you referring to the FCK install or RC2? I reckon I've crossed all the i's and dotted the t's but hey, who knows?

 

I'd have no issue with allowing you to log into the admin section of the site and see for yourself if you're OK for me to PM you the details.

 

The front end is at www.teamkaj.com.au/jetspeed/catalog

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...