Visibility Textarea IDs

miasma - November 14, 2007 - 18:27
Project:Whizzywig
Version:5.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:sdecabooter
Status:duplicate
Description

First off let me say, nice module - I'm going to be using this over fck from now on!

one problem I have run into is this - when I use the 'Filter visibility based on textarea IDs' - and add 'edit-body' as the ID, the editor still shows up all over the place, Including in the visibility settings textareas. In fact, as I type this I am noticing this is a bigger problem, now that the whizzywig editor is on the visibility settings textareas, it wont let me enter any text, so I can't even change it back..

Any thoughts/suggestions?

Thanks

#1

miasma - November 14, 2007 - 19:08
Component:User interface» Code

after further investigation, I have found what I think to be the problem. When you select 'Only show Whizzywig editor on textareas with IDs mentioned below' it is INCLUDING the three text areas, edit-whizzywig-visibility-id-val, edit-whizzywig-visibility-path-val, and edit-whizzywig-toolbar-buttons-list. If you look around line 384 of the module you will see that those three id's are being given to the variable $values_arr - which when on 'only show' as opposed to 'don't show' is selected, is showing the editor in the settings page, and screwing up the user input.

btw I am NOT a programmer so I could be completely wrong - but if I am on the right track then this should be an easy fix I hope?

Thanks

**edit**

Ok I think I have found the solution - Basically I moved the section where it ads the three textarea ids for the settings page into the variable $values_arr INTO the 'dont show' if statement.

Here is the whole function to see exactly what I changed - if this is correct can it be added to the next release?

<?php
function _whizzywig_validate_element_id($id){
 
$valid = false;
 
// when returned valid, the Whizzywig editor will be shown
 
$values = variable_get('whizzywig_visibility_id_val','');
 
$values_arr = split(PHP_EOL,$values);
 
  if(
variable_get('whizzywig_visibility_id',0) == 0){
   
// exclude some textfields that we need on the settings page from showing the editor
 
array_push($values_arr,'edit-whizzywig-visibility-id-val');
 
array_push($values_arr,'edit-whizzywig-visibility-path-val'); 
 
array_push($values_arr,'edit-whizzywig-toolbar-buttons-list');
   
// don't show editor if id is found in values
   
if(!in_array($id,$values_arr)){
     
$valid = true;
    }
  }else{
   
// only show editor if id is found in values
   
if(in_array($id,$values_arr)){
     
$valid = true;
    }
  }
  return
$valid;
}
?>

#2

sdecabooter - November 15, 2007 - 08:20
Assigned to:Anonymous» sdecabooter
Status:active» duplicate

This was already reported (http://drupal.org/node/185200) and fixed in the -dev release.
I will make a new release with the latest changes soon, because some issues have been fixed in the development release, that are not yet in the latest stable one.

 
 

Drupal is a registered trademark of Dries Buytaert.