Jump to content
Sign in to follow this  
MaxiDVD

[Contribution] HTML WYSIWYG Editor for Product Desc, MS1 2.2

Recommended Posts

hi it me again :oops: ,

i hav e just noticed that i can not set the min and max settings for my store :shock: normaly it look`s like

admin_box_1.gif

but in mine it look`s like

admin_box_2.gif

i click on configuration and it does not fold out.

i searched everywhere but i cant seem to find the bug :x

please help :cry:

Share this post


Link to post
Share on other sites

Hello All,

 

Great contribution!!!

 

I hope I have no mistakes here.

 

One thing to fix if you need it to work in SSL:

in function:

function imageURL($path, $encode = FALSE) {

  global $HTTP_SERVER_VARS;



  // initialize context

  $url = (IMAGE_URL . $path);



  // if URL is to be encoded ...

  if($encode) {



     // ... encode the URL

     $url = rawurlencode($url);

     $url = str_replace("%2F", "/", $url);

  }



  // return the URL

  return ("http://" . $HTTP_SERVER_VARS["HTTP_HOST"] . $url);

}

 

chnge return line to:

 

   return ("https://" . $HTTP_SERVER_VARS["HTTP_HOST"] . $url);

 

in:

function scriptURL($path, $encode = FALSE) {

  global $HTTP_SERVER_VARS;



  // initialize context

  $url = (SCRIPT_URL . $path);



  // if URL is to be encoded ...

  if($encode) {



     // ... encode the URL

     $url = rawurlencode($url);

     $url = str_replace("%2F", "/", $url);

  }



  // return the URL

  return ("http://" . $HTTP_SERVER_VARS["HTTP_HOST"] . $url);

}

 

to

   return ("https://" . $HTTP_SERVER_VARS["HTTP_HOST"] . $url);

 

 

look for another instance of "http" and change to "https".

other wise it will not work.

 

When updating the database replace all https: with http:

and do exactly the oposit when reading from the database to the textarea for editing.

 

The reason is that when you are in an SSL secured page, trying to add a picture from a nonsecured will have access denied because of security violation.

 

This is a fast fix that can be implemented much smarter.

 

 

DS

Share this post


Link to post
Share on other sites

A great contribution, definately makes it easier than showing a client how to create basic html descriptions with bullets etc and then pasting sourcecode in admin.

 

I do have to put in a vote about spellchecking if you do a new update :)

 

I seen on the HTMLArea site that some people have been able to get at least the word active x spellchecking connected as well as a free one that seems like it could be hacked into osc from http://www.master-technology.com/phpbb/

Share this post


Link to post
Share on other sites

First of all, let me say wonderful contribution, I am having a great deal of fun with it!

 

Now for the inquiry...

1. First of all my ONLY problem I have found, abd it is a quirky one. On the image below you will notice the popup window is just a hair too small and makes the canel button difficult to reach (this is the window when messing with product images, although the main window is also a slight mis-sized.) where can I alter these sizes? (I got crosseyed when I saw the number of files and after proding around like a fool I still had no luck.)

 

And of course # 2:

This of course pertains to the original WYSIWYG (I hope you can still answer however) I am planning on using the About Us, Contacts, Policy & Shipping Module that stores the data in the database rather than editing the files by hand, any ideas on how I could incorp. WYSIWYG into it?

 

size.gif


sig.jpg

Share this post


Link to post
Share on other sites
Now for the inquiry...

1. First of all my ONLY problem I have found, abd it is a quirky one. On the image below you will notice the popup window is just a hair too small and makes the canel button difficult to reach (this is the window when messing with product images, although the main window is also a slight mis-sized.) where can I alter these sizes? (I got crosseyed when I saw the number of files and after proding around like a fool I still had no luck.)

I have seen this happen before, but cant remeber the fix - you will find the answer here :

http://www.interactivetools.com/iforum/Ope...lArea_v2.0_F18/

 

And of course # 2:

This of course pertains to the original WYSIWYG (I hope you can still answer however) I am planning on using the About Us, Contacts, Policy & Shipping Module that stores the data in the database rather than editing the files by hand, any ideas on how I could incorp. WYSIWYG into it?

We just discussed this on the last page, you should download the latest "Information Pages Ulimited" Contibution it does exactly what your asking for, and on the previous page you will find the code snippets you need to succefully intergrate the WYSIWYG editor into the information pages.

 

have agander at this demo: http://www.maxidvd.com.au/ms1/admin/information_manager.php

user: demo

pass: demo

 

Information Pages Unlimited v1.1e

http://www.oscommerce.com/community/contributions,1026

 

Cheers MaxiDVD

Share this post


Link to post
Share on other sites

I posted this question a couple of pages back but never heard anything.

 

whenever I try to import the mysql info for this contrib I get an error:

 

My previous post....... :

 

I have MS2 and the 1.7 version but I am having a problem.

 

When I insert the MYSQl I get an error:

 

INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` )

VALUES (

 

'', 'PRODUCT DESCRIPTIONS use WYSIWYG HTMLAREA?', 'HTML_AREA_WYSIWYG_DISABLE', 'Enable', 'Enable/Disable WYSIWYG box', 112, 0, now( ) , now( ) , NULL , 'tep_cfg_select_option(array('Enable', 'Disable'),'

)

 

MySQL said:

 

 

You have an error in your SQL syntax near '`configuration` (`configuration_id`, `configuration_title`, `configuration_key`,' at line 1

 

 

I assume because of this when I view admin/categories.php I also get an error:

 

Line: 318

Char: 14

Error: 'HTML_AREA_WYSIWYG_DEBUG' is undefined

Code: 0

URL :blah/blah/admin/categories.php

 

I have reupped the 1.7 categories but I am getting the same error - any ideas?

 

Thanks

Share this post


Link to post
Share on other sites

yeah, I dont know why yours is playing up, but try running this directly in the SQL in PHPMyAdmin

 

INSERT INTO `configuration` VALUES ('', 'GLOBAL - ALLOW DEBUG MODE?', 'HTML_AREA_WYSIWYG_DEBUG', '0', 'Moniter Live-html, It updates as you type in a 2nd field above it.<p>Disable Debug = 0<br>Enable Debug = 1<br>Default = 0 OFF', 112, '', '2003-07-25 07:25:37', '2003-07-25 07:25:37', NULL, 'tep_cfg_select_option(array('0', '1'),');

 

If for some reason the sql still errors, try doing a manual insert of the above details, into the configuration table using the "insert".

 

Its also the cause of the JavaScript Error - yes!

 

Cheers MaxiDVD

Share this post


Link to post
Share on other sites

hmm still seem to get an error:

 

SQL-query :

 

INSERT INTO `configuration`

VALUES (

 

'', 'GLOBAL - ALLOW DEBUG MODE?', 'HTML_AREA_WYSIWYG_DEBUG', '0', 'Moniter Live-html, It updates as you type in a 2nd field above it.<p>Disable Debug = 0<br>Enable Debug = 1<br>Default = 0 OFF', 112, '', '2003-07-25 07:25:37', '2003-07-25 07:25:37', NULL , 'tep_cfg_select_option(array('0', '1'),'

)

 

MySQL said:

 

 

You have an error in your SQL syntax near '`configuration`

VALUES ( '', 'GLOBAL - ALLOW DEBUG MODE?', 'HTML_AREA_WYSIWY' at line 1

Share this post


Link to post
Share on other sites

I've never used INSERT directly, how do I know what goes where?

 

I haven't tried to continue the install - i started fressh after me previous attempt to make sure everything was clean, but I do now have a WYSIWYG section in my admin area - is it worth continueing or I need to sort this out first?

Share this post


Link to post
Share on other sites

Do you see the Debug option in admin under the wysiwyg options?

 

It should be the last option in the list, if its no there tell me what the last option is in the wysiwyg options?

 

Cheers Lee

Share this post


Link to post
Share on other sites

It is the second last option in the menu (I just installed the new Dynamic Mo Pics which has the new admin interface and that is the last one) however the dynamic mo pics wasn't installed when I first tried this (although I can't remember if i ever got an WYSIWYG entry in the admin section on my first time).

 

If I go into WYSIWYG in admin I just get:

 

WYSIWYG Editor 1.7

 

Title Value Action

 

And everything else is blank - however at this stage I haven't continued with the installation. Just thought I would stop to make sure the MYSQL is all ok. Should I try to keep installing and see if it works despite my errors.

Share this post


Link to post
Share on other sites

thanks to Maxi's help I managed to get everything working. However I noticed that the email customer function doesn't seem to use the WYSIWYG layout - and instead uses the normal text based format.

 

WYSIWYG is enabled for emailing in config and the product descripting, information pages and newsletter all work fine.

 

I don't have time to look at things now, but I imagine I have left out some code (either than or the original 'hack' didn't incorporate it).

 

Does everyone else have WYSIWYG for email or is it just me. I will look into it when I get home.

Share this post


Link to post
Share on other sites

Another possible bug?

 

Can anyone enable (or see) advanced WYSIWYG for the Inforumation Unlimited addon?

 

Can anyone help me enable this? (as well as looking at me previous past as well :-)

Share this post


Link to post
Share on other sites

Great Contibution

Y'all Kick Butt

 

Easy to install, makes page editing easy.

 

How bout the Conditions of Use, Privacy Policy and Shipping and Returns

pages . Any support for those?

Share this post


Link to post
Share on other sites

Hi MaxiDVD,

 

Top contribution. A job well done. Could you tell me how I would get it to work with Category Descriptions? Is there a 'cut and paste' routine to apply your code?

 

Cheers from Queensland

 

Lloyd Swadling

 

www.workshopdirect.com.au

Share this post


Link to post
Share on other sites

Dude, you should get some kind of award for this contrib. Seriously, I was about to wuss out and spend a bunch of $$ on a commercial cart until I tried your mod. I will recommend osCommerce/MS2 HTML to any newbie (like me) who might feel intimidated by osCommerce. Thanks again for your time spent on this contrib. - It is soooooo very appreciated :D


Andrew Mossad

Share this post


Link to post
Share on other sites

Okay this ones got me a little baffled. I am not sure if it is to do with this contribution or not. I have product listing v4 installed. When I add a description to my product I find that it pushes the dimensions of my product listing tables out. (does not word wrap and go down to the next line). It is pretty much just going across in one single line.

 

Anyone come across this?

 

I also have tried to install Unlimited pages but I have not got this to work yet. I do not think it is related htough.

Share this post


Link to post
Share on other sites

I don't see why it wouldn't be possible ... should be able to follow the instructions for wysiwyg almost all the way through!

 

I'm going to be updating latestnews shortly, but i'm still tossing up over whether to include BBCode, WYSIWYG, or both with an option ... hrm.

 

Will,

The LatestNews Guy


Will M

LatestNews (v1.1.0): Download

Share this post


Link to post
Share on other sites

I have not been recieving any emails from oscommerce to say this thread has had replies, so thats the reason for no replies :wink: sorry...

 

It can work with ANY TEXTAREA, textarea <form> , yes it will work with NewsDesk,

 

theres two parts of code need for this to work (Admin Side Only) if you for some reason wanted to allow HTMLArea to reside in your catalog - simplest thing to do would be to put a copy of the HTMLArea folder in you catalog directory. (there are some security factors that should be considered before allowing customers 'full html' access).

 

Ok put simply - if you want to use the HTMLArea on any given Contribtution there are 2 parts of code to PASTE and and 2 Simple placement Rules to follow.

 

1. the first part of the code ALWAYS comes before the closing </head> tag, this tags is always towards the top of the page...

 

 

<script language="Javascript1.2"><!-- // load htmlarea

//MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.5 <head>

     _editor_url = "<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_ADMIN; ?>htmlarea/";  // URL to htmlarea files

       var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);

        if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }

         if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }

          if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }

      <?php if (HTML_AREA_WYSIWYG_BASIC_PD == 'Basic'){ ?>  if (win_ie_ver >= 5.5) {

      document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_basic.js"');

      document.write(' language="Javascript1.2"></scr' + 'ipt>');

         } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }

      <?php } else{ ?> if (win_ie_ver >= 5.5) {

      document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_advanced.js"');

      document.write(' language="Javascript1.2"></scr' + 'ipt>');

         } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }

      <?php }?>

// --></script>



</head>

 

2. the second piece of code ALWAYS goes after the closing </form> tag...

 

</form>

 

<script language="JavaScript1.2" defer>

// MaxiDVD Added WYSIWYG HTML Area Box

var config = new Object();

editor_generate('The_name_of_this_text_area',config);

</script>

 

Replace: The_name_of_this_text_area with The name of your text area, example if you do a view source on /categories.php you will find that the actual name of the text area/s is "description[1]" so thats what name you would use.

 

email.php would be "email" or "mail", so its really quite simple to add this to any contibution you choose.

 

if you wanted Admin Control over the new HTMLArea, like the way the other are you would need to add a the querys into the database.

 

hope this helps.

Cheers MaxiDVD :lol:

Share this post


Link to post
Share on other sites

I must also praise everybody who has put their share into this contribution, especially MaxiDVD. Great Contribution.

 

Now, how do I get to the WYSIWYG for the mainpage.php?

 

I figured out I could get to mainpage.php by going to the edit language section of the tools category.

 

But once I was there I could not edit the file using the WYSIWYG, it was just an empty php file. I pasted what I wanted in there but the point of me adding this conribution is to give my clients an easy way to edit the pages.

 

Can someone help me out here?

 

Thanks


Samuel Mateo, Jr.

osC 2.2 MS2

Installed Mods:

WYSIWYG HTMLArea 1.7 | Basic Template System 1.0 | osC-Affiliate | OSC-SupportTicket

Featured Products 1.3 | LoginBox 5.2 | LatestNews 1.1.3 | Extras for IE

Share this post


Link to post
Share on other sites

Normally it is under ADMIN-->CATALOG-->DEFINE MAINPAGE

 

However when I made changes there and pressed the "SAVE" button I get:

 

Warning: fopen(C:/www/catalog/includes/languages/english/mainpage.php) [function.fopen]: failed to create stream: Permission denied in C:wwwcatalogadmindefine_mainpage.php on line 54

 

Warning: fwrite(): supplied argument is not a valid stream resource in C:wwwcatalogadmindefine_mainpage.php on line 56

 

Warning: fclose(): supplied argument is not a valid stream resource in C:wwwcatalogadmindefine_mainpage.php on line 57

 

Warning: Cannot modify header information - headers already sent by (output started at C:wwwcatalogadmindefine_mainpage.php:54) in C:wwwcatalogadminincludesfunctionsgeneral.php on line 18

 

 

I have rechecked my permission and there are 777.

Share this post


Link to post
Share on other sites

Are you sure it not the permission for that file?

I believe that is the problem.


Samuel Mateo, Jr.

osC 2.2 MS2

Installed Mods:

WYSIWYG HTMLArea 1.7 | Basic Template System 1.0 | osC-Affiliate | OSC-SupportTicket

Featured Products 1.3 | LoginBox 5.2 | LatestNews 1.1.3 | Extras for IE

Share this post


Link to post
Share on other sites

I know this may have been answered beofre but I have gone over this thread for four hours and re worked my config so many times yet I still cannot get the upload image function to work. I am on a shared ssl certificate. I have a symbolic link between my two files.

 

Can anyone help me with my config file?

 

// CONSTRAIN_* indicates the image constraints used to scale uploads (0 = none)

define("CONSTRAIN_HEIGHT", 0);

define("CONSTRAIN_WIDTH", 0);



// IMAGE_DIR and IMAGE_URL identify the Image directory "root" (MUST end in "/")

// Do NOT include "http://my.hostname.com" in IMAGE_URL; just the path from the

// DocumentRoot of your webserver.

define("IMAGE_DIR", trim("/www/htdocs/mydomain/catalog/"));



define("IMAGE_URL", trim("catalog/images/"));





// NETPBM_DIR identifies the directory where NETPBM is located (MUST end in "/")

// Not used if either CONSTRAIN_HEIGHT or CONSTRAIN_WIDTH (above) is specified as "0".

define("NETPBM_DIR", trim("/www/htdocs/mydomain/catalog/"));



// SCRIPT_DIR and SCRIPT_URL identify where these scripts reside (MUST end in "/")

// Do NOT include "http://my.hostname.com" in SCRIPT_URL; just the path from the

// DocumentRoot of your webserver.

define("SCRIPT_DIR", trim("/home/mydomain/www/catalog/admin/htmlarea/popups/"));



define("SCRIPT_URL", trim("/catalog/admin/htmlarea/popups/"));



// SUPPORT_* identify optional features

define("SUPPORT_BITMAP", TRUE);  // supported by Internet Explorer ONLY!

define("SUPPORT_CREATE", TRUE);

define("SUPPORT_DELETE", TRUE);

define("SUPPORT_METAFILE", TRUE);// supported by Internet Explorer ONLY!

define("SUPPORT_UPLOAD", TRUE);

I have tried numerous variatons but always end up with non secure images and "the requested page could not be found on this server.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×