1
Goofster
Problem adding auto-generated module config options to module
  • 2004/4/6 18:14

  • Goofster

  • Just popping in

  • Posts: 6

  • Since: 2004/4/6 1


Hihi,

I'm a relative newbie to xoops, but I'm trying to make my first module :) ia lready got it working, but now I'm adding config options to the admin area. when I add a few options and try to go to the "preferences" link of my module, I just get refered back to the system module config settings....what am I doing wrong?

thanks for helping,

Roel

2
Mithrandir
Re: Problem adding auto-generated module config options to module

Could you paste the code, you have written for the preferences?

3
Goofster
Re: Problem adding auto-generated module config options to module
  • 2004/4/6 19:04

  • Goofster

  • Just popping in

  • Posts: 6

  • Since: 2004/4/6 1


This is all I've done for it, copied it mostly from the mylinks module :)

xoops_version.php
............code.................

// Config Settings (only for modules that need config settings generated automatically)

// name of config option for accessing its specified value. i.e. $xoopsModuleConfig['storyhome']
$modversion['config'][1]['name'] = 'archive';

// title of this config option displayed in config settings form
$modversion['config'][1]['title'] = '_MI_CHAT_ARCHIVE';

// description of this config option displayed under title
$modversion['config'][1]['description'] = '';

// form element type used in config form for this option. can be one of either textbox, textarea, select, select_multi, yesno, group, group_multi
$modversion['config'][1]['formtype'] = 'textbox';

// value type of this config option. can be one of either int, text, float, array, or other
// form type of 'group_multi', 'select_multi' must always be 'array'
// form type of 'yesno', 'group' must be always be 'int'
$modversion['config'][1]['valuetype'] = 'text';

// the default value for this option
// ignore it if no default
// 'yesno' formtype must be either 0(no) or 1(yes)
$modversion['config'][1]['default'] = '';

// options to be displayed in selection box
// required and valid for 'select' or 'select_multi' formtype option only
// language constants can be used for both array keys and values
//$modversion['config'][1]['options'] = array('5' => 5, '10' => 10, '50' => 50, '100' => 100, '200' => 200, '500' => 500, '1000' => 1000);


$modversion['config'][2]['name'] = 'cabbase';
$modversion['config'][2]['title'] = '_MI_CHAT_CABBASE';
$modversion['config'][2]['description'] = '';
$modversion['config'][2]['formtype'] = 'textbox';
$modversion['config'][2]['valuetype'] = 'text';
$modversion['config'][2]['default'] = '';

$modversion['config'][3]['name'] = 'licensekey';
$modversion['config'][3]['title'] = '_MI_CHAT_LICENSEKEY';
$modversion['config'][3]['description'] = '';
$modversion['config'][3]['formtype'] = 'textbox';
$modversion['config'][3]['valuetype'] = 'text';
$modversion['config'][3]['default'] = '';

$modversion['config'][4]['name'] = 'serverport';
$modversion['config'][4]['title'] = '_MI_CHAT_SERVERPORT';
$modversion['config'][4]['description'] = '';
$modversion['config'][4]['formtype'] = 'textbox';
$modversion['config'][4]['valuetype'] = 'int';
$modversion['config'][4]['default'] = '6667';

4
Mithrandir
Re: Problem adding auto-generated module config options to module

Hmmmm....

And other module preferences is working for you? Any errors with php debug?

5
Goofster
Re: Problem adding auto-generated module config options to module
  • 2004/4/6 19:54

  • Goofster

  • Just popping in

  • Posts: 6

  • Since: 2004/4/6 1


I tracked the problem down to a check in modules\system\admin\preferences\main.php:

$config =& $config_handler->getConfigs(newCriteria('conf_modid', $mod));
$count = count($config);
if ($count < 1) { redirect_header('admin.php?fct=preferences', 1);
}

I have the idea that I'm forgetting to set something..

I also check the module table in the database, and the option "hasconfig" for the module was set to 0. however, setting it to 1 did not solve the problem.

6
Daigoro
Re: Problem adding auto-generated module config options to module
  • 2004/4/6 21:24

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2



I've not seen this functionality documented anywere on the XOOPS site, but I'm realy interested in knowing more about it, and I'll be monitoring this thread.

Also, how are the config variables soposed to be used in the actual modules?

Regards,
Daigoro

7
Mithrandir
Re: Problem adding auto-generated module config options to module

In modules, you have access to the module's configuration preferences through
$moduleConfig['config_name_as_in_xoops_version.php']

8
Mithrandir
Re: Problem adding auto-generated module config options to module

Quote:

Goofster wrote:
I tracked the problem down to a check in modules\system\admin\preferences\main.php:

$config =& $config_handler->getConfigs(newCriteria('conf_modid', $mod));
$count = count($config);
if ($count < 1) { redirect_header('admin.php?fct=preferences', 1);
}

I have the idea that I'm forgetting to set something..

I also check the module table in the database, and the option "hasconfig" for the module was set to 0. however, setting it to 1 did not solve the problem.

OK, a few small things:
You don't need a $modversion['config'][1]['options'] since it is not a select box

default value for the port should be an int, i.e. without quotes.

However, this should not break it for you.

Are you getting any errors in php debug? What does the transcript say on module installation/update regarding module config?

I'm just thinking out loud, now - but have you updated the module since you added the config items?

9
Daigoro
Re: Problem adding auto-generated module config options to module
  • 2004/4/6 21:52

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Thanks for your (always) quick answer Mithrandir.

I did understand that it was available though the $moduleConfig[] structure, what I don't know is if there are any special rules attatched to its usage.

I ask, because it would be smart to have these things documented, so that a common structure can be used for all (future) modules.

Best regards,
Daigoro

10
Mithrandir
Re: Problem adding auto-generated module config options to module

Documentation? /me points at Hsalazar and passes "the monkey" on to the documentation team.

I agree that documentation on this point also is needed, but could you elaborate on what you think of as special rules? You mean for what it should be used or huh?

If that's the case, I would say that it is entirely up to the module developer to specify, which configuration options should be available through the module preferences. Not sure that it answers your question, though.

Login

Who's Online

884 user(s) are online (49 user(s) are browsing Support Forums)


Members: 0


Guests: 884


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits