4 of 4
4
Xinha WYSIWYG Editor Extension Release v1.0
Posted: 10 March 2007 09:32 PM   [ Ignore ]   [ # 55 ]  
Grad Student
Avatar
Rank
Total Posts:  59
Joined  11-14-2002

I have a glitch that has cropped up.  I have 2 weblogs with their own custom fields.  Each has a textarea that I’m using Xinha on (as well as a textarea that I’m not using it on).  The fields have the exact same options except one is required and one is not.  When I display a weblog entry in one, whether viewed in the backend or through a template, all line break and paragraph tags vanish (verified by looking at the source), but for the other weblog the entries display fine.  When I look in the database the entries in either weblog contain the markup, as they do if I just go to edit them.  Both have formatting set to none.  I did a couple of searches in the Xinha forums but couldn’t find mention of this kind of issue so wondered if anyone had come across it here or knew what might be the cause.

Profile
 
 
Posted: 11 March 2007 05:27 AM   [ Ignore ]   [ # 56 ]  
Grad Student
Avatar
Rank
Total Posts:  59
Joined  11-14-2002

All I needed was a good night’s sleep I guess.  There was a difference in the weblog configuration itself.  In one I had allowed all HTML while in the other I allowed only safe HTML.  When I change it to allow all HTML then everything displays as expected.

Profile
 
 
Posted: 19 March 2007 05:50 AM   [ Ignore ]   [ # 57 ]  
Summer Student
Avatar
Total Posts:  28
Joined  02-22-2007

I’m now a paid-up EE user so can post here. smile

Thanks for the extension Vik.

I need to enable my client to edit category descriptions, which contain markup. Line 259 of my ext.xinha.php is:

$settings['Text_Fields_To_Use_With_Xinha']    = array('ms', array('field_id_31' => "Static Pages Content field", 'cat_description' => "Category Description field"));

I’ve selected both of those in the extensions settings page. However, when loading up the administrate weblog categories page the textarea isn’t xhinafied. (It’s also rather small.)

Can anyone see what I’m doing wrong? Or is there a better way for me to let the client edit category descriptions?

Thanks.

Profile
 
 
Posted: 22 March 2007 07:38 AM   [ Ignore ]   [ # 58 ]  
Research Assistant
RankRankRank
Total Posts:  332
Joined  10-11-2004

Couldn’t understand why xinha was working on one weblog and not another and spent whole morning tracking it down!

The problem seems to be that xinha does not like fields listed here that are not being used:

/** STEP 2 **************************************************************
    * Set which fields will get Xinha
    ************************************************************************/
                
    
xinha_editors = xinha_editors ? xinha_editors :
    
[ "field_id_2","field_id_1"
                
];

This works on standard weblog

/** STEP 2 **************************************************************
    * Set which fields will get Xinha
    ************************************************************************/
                
    
xinha_editors = xinha_editors ? xinha_editors :
    
[ "field_id_2","field_id_1aaaaaaa"
                
];

Now no fields are xinha’d and javascript error in console “textarea has no proporties”.

Profile
 
 
Posted: 22 March 2007 10:34 AM   [ Ignore ]   [ # 59 ]  
Summer Student
Avatar
Total Posts:  28
Joined  02-22-2007
Phoebe - 22 March 2007 07:38 AM

The problem seems to be that xinha does not like fields listed here that are not being used:

As I’m trying to use Xinha with different weblogs, each with unique custom fields, I’m getting this too.

this._textArea has no properties
Xinha
(null, Object version=757 width=auto height=auto)XinhaCore.js (line 149)
makeEditors(["field_id_31", "field_id_40"], Object version=757 width=auto height=auto, [])XinhaCore.js (line 5354)
xinha_init()index.php (line 2013)
onload(load )

Profile
 
 
Posted: 22 March 2007 12:13 PM   [ Ignore ]   [ # 60 ]  
Research Assistant
RankRankRank
Total Posts:  332
Joined  10-11-2004

The choices are to fix xinha to ignore unused fields or modify the extension to only output fields for the current weblog.  The trick is to find the name of the current weblog.

I put this in the xinha extension but although the publish class is defined it does not seem to be accessible.  Not even sure this would help anyway.

function add_header($which,$errors,$entry_id)
    
{
        
global $PREFS,$PB,$PUB;
        
print_r($PUB);        
        
print_r($PB);
print_r(get_declared_classes());

Anyone any thoughts?

Profile
 
 
Posted: 23 March 2007 07:28 AM   [ Ignore ]   [ # 61 ]  
Research Assistant
RankRankRank
Total Posts:  332
Joined  10-11-2004

Have it working.  This is what I did:

Hack to cp.publish.php in order to pass weblog_id

// -------------------------------------------
        // 'publish_form_headers' hook.
        //  - Adds content to headers for Publish page.
        //
        // PHB passed weblog_id
        
$DSP->extra_header .= $EXT->call_extension('publish_form_headers', $which, $submission_error, $entry_id,$weblog_id);
            if (
$EXT->end_script === TRUE) return;
        
//
        // -------------------------------------------


Filter for this weblogs fields in ext.xinha.php

// -------------------------------
    //  Add JavaScript Header
    // -------------------------------
     
    
function add_header($which,$errors,$entry_id,$weblog_id)
    
{
        
global $PREFS,$DB;
        
        
// get list of fields in this weblog
        
$sql="SELECT concat('field_id_',field_id) as fieldname
                   FROM exp_weblogs ,exp_weblog_fields
               WHERE exp_weblogs.field_group = exp_weblog_fields.group_id AND
                    field_type='textarea' AND
                    weblog_id="
.$weblog_id;
     
$query=$DB->query($sql);
     
     
$PossibleFields=array();
     foreach(
$query->result as $row) {
          $PossibleFields[]
=$row['fieldname'];
     
}
        
        $FieldsToUse
= array();
        
        
$FieldsToUse = array_intersect($PossibleFields,$this->settings['Text_Fields_To_Use_With_Xinha']);
        
        
// print_r($this->settings['Text_Fields_To_Use_With_Xinha']);  // this is what I use to see the array's contents during testing

        
$r = '

And use this filtered field to output to page header:

/** STEP 2 ***************************************************************
                    * Set which fields will get Xinha
                    ************************************************************************/
                    
                    
xinha_editors = xinha_editors ? xinha_editors :
                    
[ ';
                        $this->OutputArrayAsDoubleQuoteDelimitedList($FieldsToUse, &$r);
                        
                        $r = $r . '
                    
];

Profile
 
 
Posted: 23 March 2007 07:30 AM   [ Ignore ]   [ # 62 ]  
Research Assistant
RankRankRank
Total Posts:  332
Joined  10-11-2004

Also, my change to settings in ext.xinha.php to allow selection of any textarea field:

function settings()
    
{
        
global $PREFS,$DB;
        
        
$settings = array();
        
        
$settings['Xinha_Folder_url']        = $PREFS->ini('site_url', TRUE);

        
$settings['CSS_url']        = $PREFS->ini('css_url', TRUE);

        
$sql='SELECT field_id,field_name FROM exp_weblog_fields WHERE field_type="textarea"';
         
$query= $DB->query($sql);

       if (
$query->num_rows>0) {
               
foreach($query->result as $row) {
                 $text_fields[
'field_id_'.$row['field_id']]=$row['field_name'];
                
}
        }
        

        $settings[
'Text_Fields_To_Use_With_Xinha']    = array('ms', $text_fields,'');

        
$settings['Plugins_To_Use_With_Xinha']        = array('ms', array('Abbreviation' => "Abbreviation",
                                                                        
'BackgroundImage' => "BackgroundImage",

Profile
 
 
   
4 of 4
4
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 66475 Total Logged-in Users: 39
Total Topics: 84879 Total Anonymous Users: 20
Total Replies: 455404 Total Guests: 211
Total Posts: 540283    
Members ( View Memberlist )