Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 10:56 am EDT

Geeklog Forums

Add a configuration variable issue on plugin upgrade


Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
This is the initconfig code for my jquery plugin
Text Formatted Code

function plugin_initconfig_jquery()
{
    global $_CONF, $_JQ_DEFAULT;

    $c = config::get_instance();
    if (!$c->group_exists('jquery')) {

        //This is main subgroup #0
                $c->add('sg_0', NULL, 'subgroup', 0, 0, NULL, 0, true, 'jquery');
               
                //This is fieldset #1  in subgroup #0  
                $c->add('fs_02', NULL, 'fieldset', 0, 1, NULL, 0, true, 'jquery');
                $c->add('use_lightbox', $_JQ_DEFAULT['use_lightbox'],
                'select', 0, 1, 3, 10, true, 'jquery');
                $c->add('use_feedback', $_JQ_DEFAULT['use_feedback'],
                'select', 0, 1, 3, 20, true, 'jquery');
                $c->add('use_codehighlighter', $_JQ_DEFAULT['use_codehighlighter'],
                'select', 0, 1, 3, 30, true, 'jquery');
                $c->add('use_ckeditor', $_JQ_DEFAULT['use_ckeditor'],
                'select', 0, 1, 3, 40, true, 'jquery');
                               
                //This is fieldset #2  in subgroup #0  
                $c->add('fs_03', NULL, 'fieldset', 0, 2, NULL, 100, true, 'jquery');
                $c->add('lightbox_width', $_JQ_DEFAULT['lightbox_width'],
                'text', 0, 2, 0, 110, true, 'jquery');
                $c->add('lightbox_height', $_JQ_DEFAULT['lightbox_height'],
                'text', 0, 2, 0, 120, true, 'jquery');
                }
    return true;
}
 


This works like it is suppose to: 2 fieldsets are created with configuration variables in each one.

Now if I want to update the jquery plugin I use in plugin_upgrade_jquery function:

Text Formatted Code
                case '1.2':
                        $c = config::get_instance();
                        $c->add('fs_03', NULL, 'fieldset', 0, 2, NULL, 100, true, 'jquery');
                        $c->add('lightbox_width', $_JQ_DEFAULT['lightbox_width'],
                'text', 0, 2, 0, 110, true, 'jquery');
                        $c->add('lightbox_height', $_JQ_DEFAULT['lightbox_height'],
                'text', 0, 2, 0, 120, true, 'jquery'); 
 

and this code insert my configuration variables "lightbox_width" and "lightbox_height" in the fieldset #1 and fieldset#2 is not created :banghead:

If I use this code:

Text Formatted Code
                case '1.2':
                        $c = config::get_instance();
                        $c->add('fs_03', NULL, 'fieldset', 0, 0, NULL, 100, true, 'jquery');
                        $c->add('lightbox_width', $_JQ_DEFAULT['lightbox_width'],
                'text', 0, 0, 0, 110, true, 'jquery');
                        $c->add('lightbox_height', $_JQ_DEFAULT['lightbox_height'],
                'text', 0, 0, 0, 120, true, 'jquery'); 
 

The second fieldset is created with the 2 configuration variables but is before the fieldset #1 in the config

Could it be a bug or I'm missing something?

Ben


I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
Hey Ben,

I forgot to look into this question you have. Did you get it solved?

Looking at your first code example I do not see anything wrong and it should work. The one thing I would suggest is to specify a tab as well when adding a config item. You are supporting the Geeklog scripts library which requires 1.8.0, which is the same for tabs.

If you haven't solved your problem did you want to send me your plugin (an old version and your new version) so I can test the upgrade?

Tom
One of the Geeklog Core Developers.
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
This is not yet solved, I will send you the 2 versions of the jquery plugin.

Thanks,

Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Rolling Eyes Very strange... After more tests all is working as expected. Maybe my first test site was corrupt.

Thanks,

Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

All times are EDT. The time is now 10:56 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content